1. How to create lookup field in Salesforce flow?
Ans : There is no direct way to create a lookup field in flow but we can use workaround mentioned in this post.
2: How to handle fault in Salesforce flow?
Ans : We can send emails or fault screen can be created. If any element is connected to second screen, it automatically becomes fault screen and we can use “$Flow.FaultMessage” on screen to show error message. output text can be added on screen with message something like “Sorry, an error occurred in the page. For help, provide your administrator with the following information: {!$Flow.FaultMessage}”.
3 : How to redirect Salesforce flow after completion, if end URL is known in advance?
Ans :
There are two approach :
First by using “retURL” parameter in URL of flow
1 https://instance.salesforce.com/flow/flowName?retURL=page_name
and second, if flow is used in Visualforce page then
1 <apex:page>
2 <flow:interview name="MyUniqueFlow" finishLocation="{!$Page.MyUniquePage}"/>
3 </apex:page>
4 or
5 <apex:page>
6 <flow:interview name="MyUniqueFlow" finishLocation="{!URLFOR('/home/home.jsp')}"/>
7 </apex:page>
4 : What are difference between lookup and fast lookup data elements in flow?
Ans : Lookup record will return only first matching record however to get all matching record, we should use fast lookup. Any data element with prefix “fast” means to work in bulk. As shown in below image we have two flavors of Data element in flow for CRUD operation.
Salesforce Flow Data Elements
5: What is use of loop element in Salesforce flow ?
Ans : Loop element in Salesforce flow is used to iterate elements in collection. You can compare it with “for or while” loops in programming language. Below image shows sample of flow, which uses Loop element to mass update lead records by changing some value iteratively using loop element.
Sample Salesforce flow using loop element
6: Which interface needs to be implemented in Apex to be used in Flow ?
Ans : We can execute apex as well using flow by annotating it with “@InvocableMethod” and marking method as static. However this method only takes one parameter of type list. If we want to send multiple parameters, then simplest way is to create comma separated list of argument and pass it. In this method, we can break it and use according. Below is sample code
1 Global class Flow_UpdateAccountField {
2 @InvocableMethod
3 public static void performUpdate(List<String> lstCSV){
4 List<String> recIds = lstCSV[0].split(',');
5 //0 - AccId, 1-field1__c
6 Account acc = new Account(Id=recIds[0], field1__c=recIds[1]);
7 update acc;
8 }
9
10 }
7 : How to create non mandatory dropdown field in Salesforce flow ?
Ans : We cannot create non mandatory dropdown field in flow (at time of writing this). However there is simple workaround as explained in this post.
8 : How to create two columns page layout in Salesforce Flow ?
Ans : We cannot create two column page layout in Salesforce flow (at time of writing this post). However we can use workaround explained in this post.
9 : How to set finish location of Salesforce Flow for newly created record inside flow ?
Ans : Currently there is no way to set finish location of Salesforce flow by point and click or Visualforce. We have to write Apex controller or controller extension to achieve this. Below is sample code.
Visualforce code:
1 <apex:page standardController="Account" extensions="Flow_redirect_finish">
2 <flow:interview name="Create_Contact" interview="{!contactFlow}" finishlocation="{!NewRecordId}">
3 <apex:param name="varAccountId" value="{!$CurrentPage.parameters.parameter1}"/>
4 <apex:param name="varCallLogId" value="{!$CurrentPage.parameters.parameter2}"/>
5 </flow:interview>
6 </apex:page>
Apex code :
1 public class Flow_redirect_finish {
2 private Account objAcc ;
3 public Flow.Interview.Create_Contact contactFlow { get; set; }
4
5 //Constructor for Controller extension
6 public Flow_redirect_finish(ApexPages.StandardController stdController){
7 objAcc = (Account)stdController.getRecord();
8 }
9
10 private String readFlowVariable() {
11 if (contactFlow == null) return '';
12 else return contactFlow.varContactId;
13 }
14
15 public PageReference getNewRecordId(){
16 return new PageReference('/' + readFlowVariable() );
17 }
18 }
10 : How to create Dependent Picklist ?
Ans : Dependent picklist cannot be created in Salesforce flow. However there is work around. Lets say, if we need dependent picklist of level 3, like first select “country” and then “state” and then “city”, then we will need three screen. We can take help of Custom object, Custom setting or Custom Metadata types as discussed in this blog post.
1 Comments
How to create multi select picklist from the records in visualflow?
ReplyDeleteFor example : I have to query last created 10 accounts and I have to show the 10 Account names in the multi select picklist in visual flow.
Is it possible in Flow?