Use Lightning Web Components in Flow

Using LWC in Flow

As part of Winter 20, we can embed Lightning Web Components in Flow. Imagine, endless possibilities for Rapid Application Development (RAD) and ease of maintaining application.

Few examples where this could come handy are like embedding lookup components (no more workaround), showing data table, capturing signature, slide shows and so on.

It’s time to jump into water. In this blog post, I would be creating Simple Lightning Web Component (LWC). This LWC Component would be able to get value from flow, pass value to flow, navigate to Next screen and hookup into flow validation engine to restrict next page navigation if there is error in LWC input.

Note : Read this blog post to learn how to embed Aura Component in Flow.

Send Salesforce Survey Without Code

Send Salesforce Survey using Flow and Process Builder

Salesforce Survey is available in Health Cloud & Financial Service Cloud otherwise its paid. Community Cloud is also required to use Survey.  If you need to practice Survey, create a 30 day trial org from this URL (mentioned in this trailhead module). One Survey can be created and used in Enterprise and Unlimited edition, so if you need only one survey then its free. In my case, I had to send same question to every customer on Case close , so it was free.

Prerequisite to use Salesforce Survey

Step 1 – Enable & create Community. Once community setup is done, we would need to activate it. Community can be created by any template. It can be blank as well, if it’s being created only for survey.

Step 2 – Enable Salesforce survey by navigating to Admin setup. You would need to select Community, which would be used by Survey to compute public unique link.

Salesforce - Enable Survey
Salesforce – Enable Survey

Embed Lightning Component in Flow

Use Lightning Component in Salesforce Flow

Most of us are big fan of Flow but at the same time we miss a lot of obvious features like lookup fields, model dialogues etc.  This blog post might bring excitement and motivation to give more attention and love to Flow.

Around 3 years back, I had written a post on how to create a lookup component in Flow. That solution was just a workaround without user friendly experience. Lets focus on better user interface today, In this post we will give lookup field ability to flow by simply reusing existing Lightning Component.

Click here for animated image showing Flow in action supporting Lightning Component.

First and foremost, make sure you enable Enable Lightning runtime for flows by navigating to Workflow | Process Automation Settings , Otherwise flow would not run in classic runtime environment.

Create Breadcrumb Or Chevron Control in Salesforce Flow

Chevron Component in Flow

Have your end user complained or wanted some more coolness from Flow ? Do they want to have a nice clickable graphical presentation at top of page showing their progress or page number ? Recently, I was having a discussion with my colleague on same requirement. User should be able to jump between pages and at the same time, pictorial status should be displayed. Can we do it in Flow ? Can we create a chevron control or breadcrumbs in Salesforce Flow. Answer is yes.

Winter 18 has lots of cool functionalities for flow and we should not be left behind in adopting flow as part of our solution, at last, its point and click instead of code.

I will take help of my previous article, which explains how images can be used in formula field from static resources. In our case, instead of formula, we will use Display Text component in Flow. For this post, you can upload this zip file as a static resource and use in FlowThis zip file contains total 6 images for three pages, active and inactive images.

Salesforce Winter 18 Release – My Favorite Features

Salesforce Winter 18 Logo

There are many cool features features in Winter 18, however I would be listing only my favorite top picks from 589 pages of release notes. Would suggest to through this post to understand Sandbox readiness dates for Winter 18.

You can check materials of this meetup as well organized by Amit, where I shared my favorite Winter 18 feature with sample code.

  1. New Lightning Base Components

Lightning Base components are out of the box component created with Salesforce Lightning Design System CSS. If there are no Lightning Base components, You would need to use aura or HTML components and write custom CSS to make look and feel similar to Lightning Experience. Base component starts with lightning: namespace. There are many new Base components introduced like lightning:datatable ,  lightning:checkboxGroup , lightning:dualListbox ,  lightning:progressIndicator , lightning:progressBar,  lightning:slider. Recently only I blogged about Read only Chevron Component with mountains of code. Even though we are using this component for last 6 months however If my project could have waited, then all I had to use is 5-6 lines of code using lightning:progressIndicator.

2. Component Library (Beta)

We can already see all standard and custom component information using https://<myDomain> URL. However, as part of Winter 18 release, Salesforce came up with revamped website just like Lightning Design System to show code snippets on how to use Lightning Components. You can navigate to Component Library using https://<myDomain> URL.

3. Lightning Data Services (GA)

We are hearing about Lightning Data Services from almost last one year and finally its generally available for use. You can check this blog post on how to use it.

Salesforce Spring 17 release – My favorite features

Salesforce Spring 17

In this post, I would be only talking about Generally available (GA) features, excluding pilots and Beta. Saving those awesome features for suitable time to come. So, here are some of my favorite picks from Spring 17.

Composite Resource

Imagine we are doing REST API call from external system by creating Account first and then contact. In between if internet connection is gone or user closes browser and only Account created without contact ?  From Spring 17, we can reduce number of REST API calls made by combining them in single request. Advantage of this feature would be easier transaction management and API limit saving. You can have up to 25 subrequests in a single call. Up to 10 of these subrequests can be query operations, including Query, QueryAll, and “Query More” requests to obtain the next batch of query results.

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

and second,  if flow is used in Visualforce page then

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

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.

Non mandatory dropdown field in Flow

I have been working on Salesforce flow for a time now and faced many challenges. I always had an option to use Visualforce page however Flow is fun and powerful. In previous article , I have explained how we can create two column layout in flow, which was very easy to use.

Recently, I came to know that we cannot create none required dropdown field in Flow. So please vote this idea so that we will not need this workaround.

Making none mandatory dropdown field is very easy and you don’t need to know any coding, just follow below simple steps:

  1. Download JQuery and save it as a static resource by name “JQuery”.
  2. Copy below Visualforce page
  3. Replace “flow:interview” name by your flow name
  4. If you are expecting any URL parameter then simply add it as “apex:param” as shown in code
  5. Add your field names which does not need to be mandatory in variable “nonMandatory”
  6. In your Flow, add “– None –” as first choice in dropdown

Lets repeat above steps in detail with an example.

Creating two column layout in Flow

Salesforce Two column layout in Flow
Salesforce Two column layout in Flow

Salesforce flow does not support two column page layout in flow, please vote this idea if you want it as out of box functionality.

However, using below solution we can convert single column page layout to double column layout in flow.

We need to embed flow in below Visualforce. Not necessarily you need to have a knowledge of Visualforce code, simply copy paste in your Salesforce organization and replace flow name with your flow name in your organization. This Visualforce page uses JQuery library to manipulate DOM element. Please download latest version of JQuery and save it as static resource with name “JQuery2_1_4” or you can also update static resource name in below code.