Friday, December 23, 2016

Enabling Debug Log for Public User (Guest User license) after Winter 17 Release

Before winter 17 release, you can enable debug logs for site users (Guest users related to force.com sites) but after winter 17 release, Salesforce is not capturing the logs of site users as large number of events can quickly fill the debug logs.

So in order to enable logs for site users if you have to debug some issue related to VF page hosted on force.com site, then you have to set special cookie in user's browser.

Follow below steps in order to set cookie in google chrome:

  • Navigate to your site.
  • Open Chrome Developer tools or press Cntrl + Shift + J.
  • Enter below instruction to set cookie
    • If you use a .force.com domain, use this command. document.cookie="debug_logs=debug_logs;domain=.force.com";

    • If you use a custom domain (for example, myTestDomain.com), then use document.cookie="debug_logs=debug_logs;domain=myTestDomain.com";
To set a browser cookie in for other browsers, you have to install a plug-in or extension.



Tuesday, December 13, 2016

Best way to deal with user supplied inputs in dynamic SOQL query -SOQL Injection

Through SOQL Injection, end user can play with the data present in your organization. End users can specify input which can alter your dynamic SOQL query and return sensitive data to user on UI.

Consider a scenario where user search account present in your org by specifying account name as a search text. Below is sample VF and apex code which explain SOQL injection.

Suppose you enter "test" and click on search, system will return all account name as test. Below is SOQL query which will be executed:

SELECT Id, name, industry, BillingStreet, BillingState, BillingCity, BillingCountry FROM Account WHERE Name like '%test%' 


Now if you enter " test%' OR Name LIKE '% " and click on search account button, then system will return all account in system. 

Actually after entering above text, SOQL query will become like this:

SELECT Id, name, industry, BillingStreet, BillingState, BillingCity, BillingCountry FROM Account WHERE Name like '%test%' OR Name LIKE '%%' 



SOQL injection allow end users to reconstruct your SOQL and fetch sensitive data from your org.

Resolution:

  • Try to use static SOQL and bind user input variable in that.
  • If you have to use dynamic SOQL for your requirement, then user use the escapeSingleQuotes method for all user input strings. This add escape character (\) to all single quotation marks in string that is specified by end user. 

Below is modified apex code to avoid SOQL injection:

public PageReference query() {
        if(name !=null && name !=''){
            name = String.escapeSingleQuotes(name);
            accList = new List<Account>();
            queryString= 'SELECT Id, name, industry, BillingStreet, BillingState, BillingCity, BillingCountry   FROM Account WHERE ' + ' Name like \'%' + name + '%\'';
            accList = Database.query(queryString);
        }else{
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Please enter search text value'));
        }
        return null;
    }

Now if user enter " test%' OR Name LIKE '% "  and click on search account button, the dynamic SOQL query will become as mentioned below and system will not display anything on UI.

SELECT Id, name, industry, BillingStreet, BillingState, BillingCity, BillingCountry FROM Account WHERE Name like '%test%\' OR Name LIKE \'%%' 


Saturday, December 10, 2016

Round Off Field Values in VF page

Suppose a field (Opportunity Amount field) value is 12.34 and you have to round off it to 1 decimal places on VF page, Then use below syntax:


<apex:page standardController="opportunity" >
<apex:outputText value="{0, number, ###,###.0}">
<apex:param value="{!opportunity.amount}"/>
</apex:outputText>

</apex:page>

Output on VF page will be 12.3

Note: This work perfectly for number ,percent, and currency fields.



Refer Below Links for Salesforce Interview Questions


Friday, December 9, 2016

Date field Formatting on VF page

If you have to format Date fields directly on VF page, then you can use below code snippets to achieve this.

<apex:page standardController="Opportunity">
    <!--display=10/25-->
    <apex:outputlabel value="Opportunity Close date (MM/dd):" />
    <apex:outputText value="{0,date,MM/dd}">
        <apex:param value="{!opportunity.CloseDate}"  />                              
    </apex:outputText>
    <br/>

    <!--display=October 25-->
    <apex:outputlabel value="Opportunity Close date (MMMM dd): " />
    <apex:outputText value="{0,date,MMMM dd}">
        <apex:param value="{!opportunity.CloseDate}"  />  
    </apex:outputText>
    <br/>
    
    <!--display= display=25 October-->
    <apex:outputlabel value="Opportunity Close date (dd MMMM): " />
    <apex:outputText value="{0,date,dd MMMM}">
        <apex:param value="{!opportunity.CloseDate}"  />                                   
    </apex:outputText>
    <br/>
    
    <!--  display=DD/MM-->
    <apex:outputlabel value="Opportunity Close date (DD/MM): " />
    {!Day(opportunity.CloseDate)}/{!Month(opportunity.CloseDate)}                           
</apex:page>


Output on VF Page:

08/06 
August 06 
06 August 
6/8







Refer Below Links for Salesforce Interview Questions





Wednesday, December 7, 2016

Encoding and Decoding Data in Salesforce

EncodingUtil class in apex provides ability to encode and decode URL strings, and convert strings to hexadecimal format. 

Common use case can be like you want to store password of third party application which can be used while performing callout. So instead of storing the password, store encode format of password and and decode it while performing callout. Below is sample code which uses EncodingUtil methods to encode string and then decoding it back to string.

String password = 'Password123';
system.debug('******password' + password);
system.debug('******password Blob' + blob.valueof(password));
String encodedPassword = EncodingUtil.base64Encode(blob.valueof(password));
system.debug('********encodedPassword:' + encodedPassword);
blob decodedPasswordBlob = EncodingUtil.base64Decode(encodedPassword);
system.debug('********decodedPassword Blob:' + decodedPasswordBlob);
system.debug('********decodedPassword:' + decodedPasswordBlob.tostring());












Suppose you have to pass some parameters while performing callout, then you can encode your url parameters.
For example you have to send timestamp in url in yyyy-MM-dd'T'HH:mm:ss.SSS'Z' format. Below is sample code.

DateTime d = System.now();
String timestamp = ''+ d.year() + '-' +
d.month() + '-' +
d.day() + '\'T\'' +
d.hour() + ':' +
d.minute() + ':' +
d.second() + '.' +
d.millisecond() + '\'Z\'';
     
system.debug('********timestamp:'+timestamp);
String urlEncodedTimestamp = EncodingUtil.urlEncode(timestamp, 'UTF-8');
system.debug('********urlEncodedTimestamp:'+urlEncodedTimestamp);
//then you can append it to URL parameters. You can use below method to decode URL encoded strings.
String urlDecodedTimestamp = EncodingUtil.urlDecode(urlEncodedTimestamp, 'UTF-8');
system.debug('********urlDecodedTimestamp:'+urlDecodedTimestamp);





Wednesday, November 23, 2016

Smart Table using AngularJS in Visualforce page

AngularJS provide functionality through which we can display records in table and can perform sorting, searching, pagination etc on client side (on Visualforce page). Previously we have to write sorting, searching logic in apex controller and need to call controller methods to perform operation and then rerender the page. AngularJS makes this job easy.

Below is sample angularJS code present in visualforce. This page display Account and its related cases. User can sort cases and search cases from related cases.



Please see below snaphot. In order to test this code, pass account id in url as below URL
https://ap1--skforce.ap1.visual.force.com/apex/smartTableAnguarJs?id=0019000000ld4kN






Refer Below Links for Salesforce Interview Questions

Wednesday, October 19, 2016

Visualforce Component for Record Status Progress Bar

Sometimes we have to display current status of record through progress bar on record detail page. For example user can directly see the status of current opportunity or case by looking into detail page of record.




For this purpose we generally create a VF page and embed it in record page layout.

I have created a generic visualforce component which can be used to display record status bar. We just have to pass the object API name and field API name to component and it will generate status bar for you.

Upload below image image in static resource and name it as "progressbar".


Just create a new VF page and include this component in it. Below is code for visualforce Component and visualforce component Controller.


Suppose we need to display progress bar for opportunity stage, then use below code.

<apex:page standardController="Opportunity">
<c:StatusProgressBar objectAPIName="Opportunity"  fieldAPIName="stagename"/>
</apex:page>

Note:
  • You need to specify the objectAPIName and fieldAPIName for which you want to display progress bar.
  • Add this VF page to page layout to display progress bar.

Opportunity Record Detail Page



Now suppose you want to display progress bar for case record then create a VF page and use below code:

<apex:page standardController="Case">
<c:StatusProgressBar objectAPIName="Case" fieldAPIName="Status"/>
</apex:page>

Here we are displaying the progress bar for status field present in case. You can display status bar for any picklist field (standard or custom).



Friday, October 14, 2016

Batch Apex Job Progress Bar

We can display the progress of Batch Apex job on UI to user. Apex allows you to query the job status by query AsyncApexJob  object and getting all details about running job like status, JobItemsProcessed, NumberOfErrors, TotalJobItems etc. By using apex, we can manipulate the result and display the progress bar for batch job.

Suppose you already have Apex Batch class written. Here for example "RecordTypeAccessFinder" is batch class is already present.

Below is VF page and Apex class Code:



Monday, October 3, 2016

Asynchronous Apex- Apex Scheduler, Batch Apex & Future Methods Implementation Tricks

Salesforce provide different options to run asynchronous jobs which can run in background whenever salesforce resources will be available.

Apex Scheduler is one of the options through which you can schedule a job to run after certain interval of time or to run at particular time everyday, every week, every month etc.

Batch Apex allows you to process large volume of data. Normal apex class will hit governor limits if we process large volume of data. Batch Apex split the records in different batched and you will get new governor limits for each batch.

Future methods runs asynchronously which can be used to perform some operation in background. When you are executing particular code and you want to perform some other operation and don't want to wait for it to get completed, then you can use future method to perform that operation and you can continue executing your code. You can consider that future methods starts new thread or execution.

Now we are going to cover different scenarios related to future methods and apex schedulers and batch apex.


  • Is it possible to call future method from apex scheduler or not?
         Yes

Below is sample code which I tested for this scenario. After scheduling the scheduler, I checked the debug logs and it was displaying logs for future handler  and debug statement present in future method was present in logs.

//Scheduled Apex 
public class DemoScheduler1 implements Schedulable{
    public void execute(SchedulableContext sc){
        system.debug('*******Going to call future method ');
        DemoAsynchronousTest.futureMethodCallFromScheduler();
    }
}
//apex class containing future method
public class DemoAsynchronousTest{
    @future
    public static void futureMethodCallFromScheduler(){
        system.debug('******futureMethodCallFromScheduler get called');
    }
    
}

  • Is it possible to do Synchronous Web service callouts from scheduled apex?
          No.

Synchronous Web service callouts are not supported from scheduled Apex. To be able to make callouts, make an asynchronous callout by placing the callout in a method annotated with @future(callout=true) and call this method from scheduled Apex. However, if your scheduled Apex executes a batch job, callouts are supported from the batch class.

  • Can we call scheduler from future method?
Yes

  • Can we call future method from batch apex (from execute method)?
No

  • Is there is any way through which we can call future method from batch apex?
As we know that a webservice can be called from batch class and webservice can call @future method. So in your batch class call webservice and which can call your @future method.         
Also you can call future method from finish method in batch class.

  • What all different things which we need to consider while using future methods?
  1. Methods with the future annotation cannot be used in Visualforce controllers in either getMethodName or setMethodName methods, nor in the constructor.
  2. You cannot call a method annotated with future from a method that also has the future annotation. Nor can you call a trigger from an annotated method that calls another annotated method.
  3. Future methods cannot be called from batch class.

  • Can we modify the scheduler class or classes referenced by this scheduler class if any scheduled job is pending?
          No

If there are one or more active scheduled jobs for an Apex class, you cannot update the class or any classes referenced by this class through the Salesforce user interface. However, you can enable deployments to update the class with active scheduled jobs by using the Metadata API.

  • What we can do if we have to deploy the scheduler class or classes referenced by this scheduler class if any scheduled job is pending for that scheduler class in target org?
By default, changes to Apex code that have Apex jobs pending or in progress can’t be deployed. To deploy these changes, do one of the following.
  • Cancel Apex jobs before deploying changes to Apex code. Reschedule the jobs after the              deployment.
  • Enable deployments with Apex jobs in the Salesforce user interface in the Deployment Settings page.



          

Tuesday, September 13, 2016

Dynamic Apex in Salesforce

You can fetch all sobject and their field information in apex by using describe methods. Apex gives 2 data types for sobject and field information.
  1. Token: A lightweight, serializable reference to an sObject or a field that is validated at compile time.
  2. Describe Result: It contains all the describe information about sobject and fields. Describe result objects are not serializable, and are validated at runtime.
It is easy to move from a token to its describe result, and vice versa. Both sObject and field tokens have the method getDescribe which returns the describe result for that token.
On the describe result, the getSObjectType and getSObjectField methods return the tokens for sObject and field, respectively.

Finding All object in Organization

Schema getGlobalDescribe method returns a map that represents the relationship between all sObject names (keys) to sObject tokens (values).
For example:
Map<String, Schema.SObjectType> schemaMapOfOrg = Schema.getGlobalDescribe();
The map has the following characteristics:
  • It is dynamic, that is, it is generated at runtime on the sObjects currently available for the organization, based on permissions.
  • The sObject names are case insensitive. 
  • The keys use namespaces as required. The keys reflect whether the sObject is a custom object.
Creating sObjects Dynamically

If we need to create contact record dynamically, then use below code:
String typeName='Contact';
Schema.SObjectType objToken = Schema.getGlobalDescribe().get(typeName);
sobject son= objToken.newSObject();
son.put('firstname','Execute1');
son.put('LastName','Kumar');
son.put('Email','sunil.kumar2@in.gmail.com');
insert son;

Apex code to find all sobject and their fields

Apex code to generate SOQL to fetch all fields of an object

Monday, September 12, 2016

RecordTypeId using Describe & SOQL

RecordTypeId of an object can be determined by using 2 different options:

For example we will find out the recordtypeId of "Renewal" recordtype of opportunity.

By Using Describe:
Id renewalRecordTypeId = Schema.SObjectType.Opportunity.getRecordTypeInfosByName().get('Renewal').getRecordTypeId();
Advantage: Saves on SOQL limits but uses a describe call.

By using SOQL:
Id renewalRecordTypeId =[select id from recordType where  sobjectType='Opportunity' AND DeveloperName='Renewal'].Id;
Advantage of SOQL: If in future, someone change the name of recordtype, the code will work as it refers developername.

Sunday, August 28, 2016

HighCharts in Visualforce Page

We can use interactive charts provided by HighCharts in Visualforce page. Here I am going to display line chart using highCharts.

For example, we will display the count of opportunity group by stage.

Download  js files from below mentioned URL and store it in static resource:

  • https://code.highcharts.com/highcharts.js
  • https://code.highcharts.com/modules/exporting.js
  • https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js

Create VF page "HighChartDemo" and apex class "HighChartDemoController". Below is VF page and apex class code:



Chart Snapshot:




HighCharts gives option to download chart in PNG, JPEG, PDF and SVG vector image.

Tuesday, June 14, 2016

Data Load through Command line Interface in Salesforce


Purpose: To insert, extract and then delete Accounts records from Salesforce.

Steps to, install data loader.

1.       Download Apex data loader. Navigate to Set up->Administration Set up->Data management->Data Loader. Click on Download Data Loader link.
2.       Install apex data loader setup.  C:\Program Files (x86)\salesforce.com\Apex Data Loader 23.0 will be default location while installing.

Below are the steps in order to achieve our requirement:

1. Create a folder and name it as “data Loader Demo” in E drive.
2. Generate Key File.
Open Command Prompt (Go to run-type cmd press enter), change directory to bin:
cd Program Files (x86)\salesforce.com\Apex Data Loader 23.0\bin>   press enter
Now type :
Encrypt   –g  randomtext


key will be generated, copy the key in notepad and save it as keyToEncrypt.txt in data Loader Demo folder. Note the path of this Key.txt file. In our case path is E:\Data Loader Demo\keyToEncrypt.txt

3. Encrypt Password and security token.
In command prompt, type
Encrypt   –e password+securitytoken  “ path of key.txt file”
For example:
Encrypt  –e  xxxxxx129k19YRftloxFbgBMkb6NZsNK  “E:\Data Loader Demo\keyToEncrypt.txt"



Save the encrypted password for later use.
In our case generated password is:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx6c75bb5c73f60175181c7aa5d1441aee65c

4. Create 4 new  folders as Mapping files, Log files, extracted Accounts and Account data      folder in Data Loader demo folder


Create mapping files for insert and delete from Apex Data Loader GUI and copy paste in Mapping files folder


Create insertAccounts.csv file in Account data folder which will be inserted into salesforce.


Log files folder will be used to store success and error files.

5. Copy config.properties from below mentioned directory:
C:\Program Files (x86)\salesforce.com\Apex Data Loader 23.0\conf


Paste this file in “Data Loader Demo” folder.

Also copy process-conf.xml file from below mention directory to “Data Loader Demo folder”
C:\Program Files (x86)\salesforce.com\Apex Data Loader 23.0\samples\conf


Data Loader Demo folder:


6. Now edit process-conf.xml file in notepad:


7. Create Batch file to do the operation in bin folder.

Create a new text file with following content:

call process "E:\Data Loader Demo" accountInsert
call process "E:\Data Loader Demo" csvAccountExtractProcess
call process "E:\Data Loader Demo" AccountDeleteProcess


Save the file as autorundataloadcommandlineinterface.bat and store it in bin folder
Path : C:\Program Files (x86)\salesforce.com\Apex Data Loader 23.0\bin
     

8. Run the batch.
Open cmd, change the directory to bin “C:\Program Files (x86)\salesforce.com\Apex Data Loader 23.0\bin” and type autorundataloadcommandlineinterface.bat, and press enter



OR you can double click on bat file to execute the process.

Now check your log files and extracted Accounts folder to see success and error files and extracted account file.


Steps to schedule the data upload process or to start execution of bat file

1. Control Panel->System and Security->Administrative Tools->task scheduler->create basic task->







Browse > C:\Program Files (x86)\salesforce.com\Apex Data Loader 23.0\bin \autorundataloadcommandlineinterface.bat file and click next


            Click on finish.



Friday, May 13, 2016

Salesforce Interview Questions-Data Management Part-2

6. Can we avoid duplicates using apex data loader which we can do through import wizard?
No.

7. What is Bulk API?
The Bulk API is used to upload high volume of data (millions of records).
The Data Loader uses the SOAP-based Web Services API by default. To use the Bulk API instead, check “Bulk API” checkbox in apex data loader settings page.
When you check Bulk API checkbox, increases the batch (upto 10000 records) which is usually 200 in normal upload.
Hard delete bypasses the Recycle Bin, so deleted records do not consume storage space and there is no way to retrieve them.

8. What is difference between “Export” and “Export All” in apex data loader?
Export: It will fetch only active records from salesforce.
Export All: It will fetch active as well as records from recycle bin.

9. True or False: Users can mass transfer records to which they do not have read access?
False

10. What is DateTime format supported in .csv file for upload in salesforce?
YYYY-MM-DDThh:mm:ss.00Z

11. Is there is any option to specify time zone for uploading records in apex data loader?
Yes. Present in settings page of apex data loader.

12. When “Hard Delete” button will be enabled in apex data loader?
When you enable Bulk API setting in apex data loader.

Salesforce Interview Questions-Data Management Part-1

1. Is it necessary to define an explicit primary key in custom objects?
No. Every object has a standard field called id. There is no need to define an explicit primary key in custom objects. The standard id field can be used as primary key.

2. In which order, we upload data in salesforce for related objects?
When loading data into a salesforce application dependencies between objects determine the order in which objects are loaded. If there is a one-to-many relationship between A and B, the data for A should be loaded before the data for B.

3. What is Upsert and how external id are beneficial?
Upsert is an API function that combines insert and updates into a single call. Upsert uses an indexed custom field or external ID to determine whether to create a new object or update an existing object.
-If the external ID is not matched, then a new object is created
-If the external ID is matched once, then the existing object is updated
-If the external ID is matched multiple times, then an error is reported
Use Upsert when importing data to prevent the creation duplicates.

4. What is import wizard?
It is easy to use tool to load Accounts, Contacts, Leads, Solutions, or Custom Objects.
-Load 50,000 records or less.
-Prevent duplicates
-Doesn’t support all standard object but supports all custom object

5. Which is API based tool supported by Salesforce and what are its advantages?
Apex Data Loader

Advantages are:-
-Is a fully supported salesforce.com product.
-Supports import from CSV or export to CSV.
-Can be used to import or export more than 50,00 records.
-Supports loading from or exporting to a database via JDBC.
-Supports custom relationships for upsert.
-Can be run from command line.

Salesforce Interview Questions-Reports & Dashboards Part-2

6. What is a Custom Report Type?
Custom report types allow you to build a framework in the report wizard, from which users can create and customize reports. You build custom report types off of the relationships (master-detail and lookup) between objects so that you can:
  • Choose which standard and custom objects to display to users creating and customizing reports
  • Define the relationships between objects displayed to users creating and customizing reports
  • Select which objects' fields can be used as columns in reports
Note that the visibility of custom report types in the report wizard is controlled by users' access to the objects in the report type.
You may define which related records from other objects are returned in report results by choosing a relationship to another object.
You can associate up to four objects to a custom report type.

7. What is difference between custom report types and standard report types?
Standard report types are report types which salesforce create itself when we create objects and relationship between them.
Custom report types allow admin to specify what all fields will be available to user while creating a report. Also its provide functionality to associate up to 4 objects.

8. How access to reports and dashboard is controlled in Salesforce?
Access to reports and dashboards are controlled by folder in which they are stored. If user has access to folder then they can run reports present in that folder.
In reports data displayed is as per running user's security access. Reports can be run on both standard and custom objects.
Reports data is always generated in real time. When a report is saved, reports configuration parameters are stored but the generated data is not stored.

9. What is analytical snapshot?
Analytical snapshot allows reports run at scheduled time to be stored as objects. Analytical snapshots are used to perform trend analysis. As an example if we want to view how monthly sales are growing, fields in a report with sales figure can be stored in a custom object every month using Analytical snapshot. Data in this custom object can then be used to perform trend analysis.
Analytical snapshot are available from the Data Management menu option. Source report in Analytical snapshot can be of the type Tabular or Summary.
Setup Analytical reports require a four step process
  • Select source report
  • Select custom object
  • Map source report fields to custom object fields
  • Schedule the frequency for taking the snapshots
10. What is dashboard?
Dashboards are graphical representation of reports. Dashboards can be generated for summary or matrix reports (and not for tabular reports). Dashboards display data as per last time report was run.
A dashboard can have upto 20 components.

11. Is it possible that data you see on dashboard and data you see on report after drilling down the report on dashboard are different?
Yes.
When a user views the drill-down report for a dashboard component, running user's access permissions determine what data is displayed on the drilldown report. Hence it is possible that data in the drill down report does not match the cumulative dashboard data.
Remember report runs based on current or logged in user and display real time data but dashboard store the information from reports when you refresh dashboard. In order to see real time data on dashboard, refresh the dashboard.
Also dashboard can run based on logged in user or specified user but reports always runs based on logged in user.

12. What are different chart types available for dashboards?
  • Vertical column
  • Horizontal bar
  • Line
  • Donut
  • Funnel
  • Pie
Funnel is used to show proportion of values against each other.
Pie is used to demonstrate proportion of single value against total.
Donut is used to demonstrate proportion of single value against total and also show the total value.

13. What are limitations of salesforce reports?
  • Support for trend analysis in Salesforce is fairly limited.
  • User Interface of Salesforce reports and dashboards is fixed. Salesforce does not support pixel perfect report.
  • Salesforce reports do not support importing data from other sources
  • When displaying objects and their children, Salesforce does not support reporting on objects that do not have any children.
  • If an object has two different related lists, then Salesforce reporting does not support displaying both these related lists together.

Reports & Dashboards-Part 1

Salesforce Interview Questions-Reports & Dashboards Part-1

1. What are different types of reports?
  • Tabular report. This is the most basic report. It displays just the row of records in a table like format with grand total. Tabular reports cannot be used for generating dashboards.
  • Summary report. This is the most commonly type of report. It allows grouping of rows of data. It supports sorting and displaying subtotals. For example in a recruiting app, a summary report could be used to display open positions classified by department name.
  • Matrix report. This is the most complex report format. Matrix report summarize information in a grid format. Matrix reports allows records to be grouped by both columns and rows.
  • Joined Reports: Joined reports let you create multiple report blocks that provide different views of your data. Each block acts like a “sub-report,” with its own fields, columns, sorting, and filtering. A joined report can even contain data from different report types.
2. What all reports can be used to generate dashboards?
Summary and Matrix reports

3. What all things are not supported in joined reports?
The following items aren’t supported in joined reports, and aren’t converted:
  • Bucket fields
  • Cross filters
  • The Rows to Display filter
4. What are bucket fields?
Bucketing lets you quickly categorize report records without creating a formula or a custom field. For example, create a bucket field named Size based on the # Employees field. Then, create buckets that group records into “Large,” “Medium,” or “Small” ranges that you define. Bucket fields can be used like any other field to sort, filter, and group your report.
You can add up to five bucket fields per report, each with up to 20 buckets. Only numeric, picklist and text field can be used for bucketing. Other data types are not supported.

5. Can we create a formula type in reports?
Yes.
Formula are not available in tabular reports but available for other report types.
Formula can be only in number, currency and percent format.

                                                                                Reports & Dashboards-Part 2

Salesforce Interview Questions-Workflow & Approval Process Part-2

6. Difference between workflow rule and approval process?
Workflow Approval
They are activated when a record is saved. Approval process are triggered by explicitly clicking the "Submit for Approval" button.
Workflow consists of single step and different action Approval process consists of multiple steps. Also different action is taken based upon whether the record is approved or rejected.

7. Is it possible to start approval process after records is created in salesforce without clicking on submit for approval button?
Yes. Process builder or apex trigger can be used to initiate approval process when record is created.

8. How we can achieve dynamic approval process like approve of position record should be user defined in hiring manager field of position?
It is possible through apex triggers because in standard approval process, you need to define approver while creating approval process.

9. Is it possible to skip steps in approval process?
Yes.
In processes that have steps that are optional depending on criteria, use the skip step feature.
To skip steps, use filter criteria or formula, then choose what should happen to records that do not meet the criteria. The options are:
- Approve Record (approves the request and performs all final approval actions).
- Go to Next Step (skips this step and goes to the next step).

10. Can we implement multilevel approval process in salesforce?
Yes. Define different steps in approval process.

11. Can we update parent record with workflow field update?
Yes, only if relationship is master detail. If it is look-up relationship, then it is not possible.


Salesforce Interview Questions-Workflow & Approval Process Part-1

1. What is workflow rule and Workflow actions?
Many of the tasks you normally assign, the emails you regularly send, and other record updates are part of your organization's standard processes. Instead of doing this work manually, you can configure workflow to do it automatically.
Workflow automates the following types of actions based on your organization's processes:
  • Tasks—Assign a new task to a user, role, or record owner.
  • Email Alerts—Send an email to one or more recipients you specify.
  • Field Updates—Update the value of a field on a record.
  • Outbound Messages—Send a secure, configurable API message (in XML format) to a designated listener.
Before adding new action you need to deactivate workflow rule and do the changes and then again activate it.

2. A workflow already exists on object. Now user want to add time dependent workflow action to it but not able to get an option to select time dependent action. What might be issue?
Evualation criteria is set to “created, and every time it’s edited”
3. What is queue?
A queue can hold a predefined set of objects and consists of a set of users. Any of the queue members can pick up tasks assigned to the queue. Users or Queues can be owners of records.
While adding queue members to queue, you can add users, public group, partner users, specify role of users etc.

4. What are approval process?
Salesforce supports wizard based easy to configure approval process. After an object is selected, the wizard guides the user through a step-by-step setup. Approval process is triggered when a user clicks on the "Submit for approval" button.
The approval process consists of the following steps -
  • Process definition
  • Initial submission actions
  • Step definitions
  • Final Rejection actions
  • Final Approval actions
Final Recall actionsIn workflow rule,action is triggered when a record meets an evaluation criteria. Workflow rules definition does not impact existing records. Workflow rule gets applied to new record creation or edits.

5. Is it possible to create parallel approval process (ability for multiple user to approve or reject a record)?
Yes. Parallel approval process allows specifying (upto 25) multiple approvers. The approver setting could be set to unanimous, or first action. In unanimous parallel approval process, all approvers must approve a request, before it is considered as approved.



Refer Below Links for Salesforce Interview Questions

Thursday, May 12, 2016

Salesforce Interview Questions-Process Builder

1. What is process builder?
The Process Builder is a workflow tool that helps you easily automate your business processes by providing a powerful and user-friendly graphical representation of your process as you build it. The Process Builder’s simple and powerful design allows you to:
  • Create your processes using a convenient layout with point-and-click efficiency.
  • Create your whole process in one place rather than using multiple workflow rules.
  • Create processes by collaborating with different teams in your business.
  • Stop using Apex code to automate simple tasks.
Automated processes in the Process Builder are based on records and consist of:
  • Criteria that determine when to execute action groups.
  • Immediate and scheduled actions to execute when those criteria are met.
Any change that causes a record to match the criteria can automatically trigger the action group.
You can use the more powerful and flexible Process Builder to perform the same actions as workflow. The process builder doesn’t support outbound messages, but you can easily create one yourself with Apex. With the Process Builder, you can:
  • Create a record
  • Update any related record—not just the record or its parent
  • Use a quick action to create a record, update a record, or log a call
  • Launch a flow—you can’t schedule this action with workflow
  • Send an email
  • Post to Chatter
  • Submit for approval
2. What should be the condition we need to specify in process builder to specify schedule actions?
Below are 2 conditions:
  • Only when record is created
  • When record is created or edited and while define criteria select the checkbox for below setting
    • Do you want to execute the actions only when specified changes are made to the record?
3. Is it possible to edit the process once it is activated?
No, You need to clone and while cloning you can create new process or create new version.

4. How to troubleshoot the errors if any issue comes in process builder?
Use the error messages that appear in the Process Builder and the emails you receive when a process fails to help solve problems that arise when you’re working with processes. When all else fails, look at the Apex debug logs for your processes.
  • Identifying Errors in the Process Builder
The API names for criteria nodes and actions are created in the background. When you create or update processes, you might see error messages that reference those names to help you identify specifically where the problem occurred.
  • Errors Received after a Process Starts Evaluating a Record
When a user performs an action that triggers a process (such as creating a record) and that process fails, the user sees a page with this error: “Workflow Action Failed to Trigger Flow.” In addition, the administrator who created the process receives an email with more details.
  • Using Debug Logs to Troubleshoot Processes
Use debug logs to find detailed information about your running processes after they finish running. For example, if a process doesn’t seem to trigger when a record meets the process’s criteria, or if you want to understand the sequence of processes being executed.

5. What user permission is required to create edit and view process?
“Manage Force.com Flow” AND “View All Data” in profile.