Salesforce Flow Interview Questions for admins – Part 23

Consider it interview questions or FAQs, However below are some high level information or gotchas related to Salesforce Flow.

220+ Salesforce Interview Questions
220+ Salesforce Interview Questions

221. 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.


222 : 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}”. Read more here.


223 : 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

https://instance.salesforce.com/flow/flowName?retURL=page_name

and second,  if flow is used in Visualforce page then

<apex:page>
    <flow:interview name="MyUniqueFlow" finishLocation="{!$Page.MyUniquePage}"/>
</apex:page>
or
<apex:page>
    <flow:interview name="MyUniqueFlow" finishLocation="{!URLFOR('/home/home.jsp')}"/>
</apex:page>

224 : 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
Salesforce Flow Data Elements

225: 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. You can check this YouTube video as well to see it in action.

Sample Salesforce flow using loop element
Sample Salesforce flow using loop element

226: 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

Global class Flow_UpdateAccountField {    
    @InvocableMethod
    public static void performUpdate(List<String> lstCSV){
        List<String> recIds = lstCSV[0].split(',');
        //0 - AccId, 1-field1__c
		Account acc = new Account(Id=recIds[0], field1__c=recIds[1]);
		update acc;        
    } 

}

227 : 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.


228 : 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.


229 : 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:

<apex:page standardController="Account" extensions="Flow_redirect_finish">  
    <flow:interview name="Create_Contact" interview="{!contactFlow}" finishlocation="{!NewRecordId}">
        <apex:param name="varAccountId" value="{!$CurrentPage.parameters.parameter1}"/>
        <apex:param name="varCallLogId" value="{!$CurrentPage.parameters.parameter2}"/> 
    </flow:interview> 
</apex:page>

Apex code :

public class Flow_redirect_finish {
    private Account objAcc ;
	public Flow.Interview.Create_Contact contactFlow { get; set; } 
	
	//Constructor for Controller extension
    public Flow_redirect_finish(ApexPages.StandardController stdController){
        objAcc = (Account)stdController.getRecord();
    } 
	
    private String readFlowVariable() {
    	if (contactFlow == null) return '';
    		else return contactFlow.varContactId;
    }
    
    public PageReference getNewRecordId(){ 
        return new PageReference('/' + readFlowVariable() ); 
    }
}

230 : 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.

Posted

in

by


Related Posts

Comments

3 responses to “Salesforce Flow Interview Questions for admins – Part 23”

  1. Venkat Avatar
    Venkat

    Hi Jitendra,
    I really liked your blog, just want to check about accessing all the interview questions from part1.

    Thank You
    Venkat

    1. Venkat Avatar
      Venkat

      Hi Jitendra,

      I was able to find the other parts of the interview questions through search box, thank you and this is a great blog.

      Regards
      Venkat

  2. Amala Singh Avatar
    Amala Singh

    Dependent picklists can be created as of summer 19

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Jitendra Zaa

Subscribe now to keep reading and get access to the full archive.

Continue Reading