Flows in Lightning Experience

Today I want to share some interesting “Flow Nuggets” I learned recently about using Flows within Lightning Experience.

Flows Are Usable In Lightning Experience

First, you can embed Flows onto Lightning pages using the Flow standard component which is currently in Beta. The Flow component can use Flows whose type is “Flow” aka Flows that have screens in them.

This allows for interesting use cases such as creating a wizard with a Flow on a stand-alone Lightning page. For example, perhaps you want to create a commission calculator wizard.

Note: They are also styled using Lightning so they look and feel like they belong in Lightning. Previously, they were, by default, styled as Salesforce Classic even though they could be embedded in Lightning with a Visualforce component and page.

How-To Steps

  1. Create an active flow whose type is “Flow”.
  2. In the Lightning App Builder, edit a page.
  3. Drag the Flow standard component onto the page and select the Flow to use.
  4. Configure any input variables as needed.
  5. Save.

Lightning Flows Can Be Record Aware

Lightning can pass the record’s id to your flow component when on a record page. If your flow has an input variable defined whose name is “recordId” and it’s embedded on a record page, Salesforce automatically passes the record’s id into your flow so you can use it.

This opens up other interesting possibilities such as:

  1. Creating Automated Flows When A Record is Opened. Technically, this isn’t supported but this could be a workaround where the flow queries the record first, does some computation(s), and then updates the record or other records.
  2. Since the flow has the record id, it can query any information from that record or related records and use that in a more context-sensitive way. For example, your commission calculator can now be embedded on your opportunity records and calculate your territory specific commission based on the opp’s products, the account executive’s commission rates and other variables.

Note: If you create an Automated Flow that updates the current record’s fields, those fields may not show the updated values because Salesforce doesn’t have a way, currently, to tell other components on the page from flows to refresh other components.

How to Run Flow from Page Button in Lightning Experience

Douglas Ayers Blog Post shows how one can use an Action button to open a Flow in Lightning to do other use cases. His example is another “Automated Flow” but it’s activated by a user instead of automatically when a record is opened.

What other ways have you used Flows in Lightning? What limitations have you come across?

Determine the Flow or Process Builder From the Error Message’s Version Id

Problem

If you’ve used Salesforce’s Visual Workflow aka Flows or process builders, chances are you’ve come across an error like this:

First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, The record couldn’t be saved because it failed to trigger a flow. A flow trigger failed to execute the flow with version ID 301i0000000LyvR. Flow error messages: <b>An unhandled fault has occurred in this flow</b><br>An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information.

That really doesn’t tell ya much other than an error happened. Up until today, I’d troubleshoot it by running the operation manually so that I’d receive the “error email” that contains all the details as to why it failed and which process builder or flow is having the issue. However, if you aren’t receiving the error email, it can be rather challenging to identify the flow or process builder having the issue, especially if someone changed one of these in production and now the unit tests are failing and stopping your deployment.

Trying to open https://…salesforce.com/301i0000000LyvR results in an “insufficient privileges” error page.

Solution

Open https://…salesforce.com/designer/designer.apexp#Id=YOURFLOWIDHERE  where YOURFLOWIDHERE is the version ID value from the error. Using “301i0000000LyvR” from the error above, open the URL https://…salesforce.com/designer/designer.apexp#Id=301i0000000LyvR. This opens the flow designer with either the process builder or flow that’s causing the issue. Yes it will open a process builder in the flow designer so beware that the culprit may be a process builder and not a flow.

Many thanks to Dakota Walker pointing this tip out in the Which Flow For Version Id Salesforce Forum Question.

What other tips do you have for troubleshooting Flow and Process Builder errors?

Salesforce Winter 2017 Release Review

I recently posted my Salesforce Spring 2017 Release Review and then remembered I haven’t reviewed the Winter Release Notes yet. Priorities….Ya know. Anyway here’s my review of the Winter 2017 Release.

See the Salesforce Winter 2017 Release Notes PDF for complete details. Note: It’s about 500 pages but covers it all. I prefer the details in one place so it’s faster to consume everything rather than clicking between various documents and other release content.

Daily Org Limits for Sending Emails with the API Have Increased

Using the Salesforce API or Apex, you can now send single emails to 5,000 external email addresses per day based on Greenwich Mean Time (GMT). You can also send mass email to 5,000 external email addresses per day per org. The maximum number of external email addresses is no longer based on your Salesforce edition. You can use your remaining daily balance of external email addresses in as many mass emails as you’d like, regardless of your edition. This feature is available in both Lightning Experience and Salesforce Classic.

VERY NICE! You can sent up to 5,000 external emails via Apex instead of being limited to the usual 1,000 per day. I can’t tell you how many hours I and others have spent trying to understand the various email limits and how to calculate them. Having 5,000 instead of 1,000 should help alleviate that further. Thank you Salesforce!

Find the Right Record with Person Account Search Enhancements

Person Account searches that contain terms spanning both business account and contact fields now return person account search results. This feature is available in Lightning Experience, Salesforce Classic, and all versions of the Salesforce1 mobile app.

The Person Account object contains fields that originate from both the Business Account and Contact objects. Previously, if a user’s search term contained information from both the Business Account object and the Contact object, such as name and title or name and address, the matching person account wouldn’t always be returned in the search results. Now, search terms that include both types of information return the right person account records.

For example, suppose that you want to find the person account record for Agatha Parker, an account executive in San Francisco. If you search for Agatha San Francisco, search results include the Agatha Parker person account record. In this case, Agatha is from the Business Account object and San Francisco is from the Contact object.

At my last employer, Person Accounts were used extensively. It’s great to see Salesforce adding additional Person Account support, especially when I could see it being used more in the future. The Spring release also has a number of Person Account enhancements.

Get a Better View with Global Instant Results

Search suggests recent and matching records from multiple objects—not just the object the user is on. These instant results let users quickly access a record before performing a full search. With this wider view of suggestions, users find what they’re looking for faster no matter where they are in the app. This feature is available in Lightning Experience only.

As users type in the search box, the list of suggested records spans multiple objects. Previously, users searching from a record or object home page would see instant results for only that object.

While a relatively minor enhancement, this will be very beneficial to users who frequently search for items by speeding up searches. It would be nice if this enhancement was available in Salesforce Classic too.

Navigate at the Speed of Lightning!

In the improved navigation model, the navigation menu that previously displayed on the side of Lightning Experience becomes a horizontal navigation bar at the top of the page, letting your users:

– Find what they need using item names instead of icons for easy recognition

– Complete actions and access recent records and lists with a single click

– Use a consistent and familiar navigation experience

This reminded me that the “tabs” used to be on the left and vertically listed. I totally forgot about this. I am glad that it’s not a vertical bar instead so that its “Use a consistent and familiar navigation experience” aka its more like Salesforce Classic. Being able to create new records and view recent records and list views for each Object Tab is really helpful.

Get Field-Level Help in Lightning Experience

Fields now show “Help Text” like Salesforce Classic. This is another welcome addition that I’ve been taking for granted.

Account Insights Is Now Called News

In Lightning Experience and Salesforce1, various news articles for a given account are shown in the related “News” component. This can be very beneficial when your Sales Reps hear about this information for the first time. When I was giving training to some executives for their new Salescloud implementation, we looked at one account and the news showed a timely and relevant article that they didn’t know.

Add Lightning Components from the AppExchange in Community Builder

This is nice but the Component AppExchange only has about 90 components at the time of this writing. Hopefully, this gets increased soon.

Launch a Lightning Component from an Action

Lightning component actions are custom actions that invoke a Lightning component. Because they support Apex and JavaScript, Lightning component actions provide a secure way to build client-side custom functionality. This feature is available in Lightning Experience and all versions of the Salesforce1 mobile app.

This feels like a really powerful addition to Lightning to help alleviate things like “Lightning Experience not supporting Javascript buttons” even though it requires coding. Andy Fawcett’s Using a Lightning Component from an Action provides a good writeup on how to use this.

AppExchange and Your Salesforce Org—Together at Last

Salesforce now allow one to view AppExchange apps from within Salesforce itself in Lightning Experience. This streamlines the back and forth between the AppExchange and Salesforce that was previously done.

Process Twice as Many Records with Bulk API

One can upload 10,000 batches a day instead of 5,000.

View Obfuscated Code in Subscriber Orgs with Login As

License Management Org users with the “Author Apex” permission can view their packages’ obfuscated Apex classes when logged in to subscriber orgs via the Subscriber Support Console

This is really helpful when trying to troubleshoot a managed package in a subscriber org. In the past, one way to see the code is to ensure every packaged release was tagged in source control so you could see the code for a particular version. This makes this a little easier to deal with.

What Winter features were noteworthy to you?

Salesforce Spring 2017 Release Review

It’s that time of year again. Salesforce released their Spring 2017 version of their software. Let’s take a look at some of the new features worth noting.

For complete details, see the Spring 17 Release Notes PDF.

Salesforce Optimizer

Salesforce runs programmatic analysis of your sandbox or production environment and then you are sent a report of the findings. From the Optimizer Included Features Help Documentation, the optimizer evaluates the following features:

  • Fields
  • Apex Triggers
  • Page Layouts
  • Report Types
  • Validation Rules
  • Sharing Rules
  • Administrator Permissions

The documentation doesn’t go into too much detail so I’ll try running this and post the results in a separate post.

Favoriting in Lightning Experience

Favorites lets you quickly access important records, lists, groups, dashboards and other frequently used pages in Salesforce. An item is favorited by clicking the star on the current page. It’s unfavorited by clicking the highlighted star again.

I’m glad Salesforce came out with this feature because so much time is spent navigating the same things usually that this saves considerable time searching and navigating. It also saves from having additional browser bookmarks. I’m also glad because I literally was prototyping a similar feature in December for a client and am glad there’s native support now in Lightning.

Manage Duplicate Person Accounts

At my former employer, we used Person Accounts heavily and it’s a great feature. One limitation was that the duplicate management feature didn’t support them. NOW IT DOES!

To create duplicate rules for them, go to the duplicate rules in Setup in Lightning Experience or Salesforce Classic.

Context-Sensitive Merge Fields and Person Account Support

In email templates, one can now see all the person account merge fields when a person account is in the “Related To Field”. This is in Lightning Experience only.

Inline Editing in List Views in Lightning Experience

Users can edit records in a listview without opening it. Also, they can search for and create records on the fly in lookup fields.

There are some fields that aren’t editable and a lock appears next to them. For example, one can’t edit multi-select picklist values. Also, users can’t edit if the listview uses filter logic.

Run Custom Mass Actions on Multiple Records in Related Lists

Remember those brilliant custom buttons that you created in Salesforce Classic by using Visualforce? With the ability to select multiple records in a Lightning Experience related list, those buttons take on new life. Watch your reps’ productivity soar when they click a button to perform a custom mass action on several records at once. This change applies to Lightning Experience only. View All records on a related list to access that list’s mass action buttons.

This definitely needs more explanation and further research. For example, javascript buttons aren’t supported in Lightning Experience so this could be a possible replacement in some cases?

Subscribe to Reports in Lightning Experience

Users can subscribe up to 5 reports but can’t set notification conditions and can only receive report results via email.

Automatically Add Emails and Events to Salesforce with Automated Activity Capture for Inbox

With Automated Activity Capture, Inbox users can connect their email and calendar to Salesforce. Then, their emails and events are automatically added to related Salesforce records. This feature is new in Lightning Experience. After you set up Inbox, Salesforce asks Inbox users to connect their Google™ or Microsoft® Office 365® account to Salesforce. Then, on accounts, contacts, leads, opportunities, and person accounts, they see their related emails and events. They also see related emails and events from others on their team.

For one particular client, this is a huge feature add. They had purchased Salesforce Inbox but then discovered they had to log emails and meetings manually all the time from Office into Salesforce. In case they don’t know about this, I’m sending them an email to let them know.

Filter Reports via URL Parameters in Lightning Experience

One can specify filters for reports now in Lightning Experience via the report’s URL parameters. This is done using fv0, fv1 … fvN parameters that match the order of the custom filters in the report. This has been used widely in Salesforce Classic for a long time. It’s good to see this added to Lightning too.

Create New Records From Lookups

Community members can now create records via lookups, a handy trick that saves time and frustration. Imagine a partner community member who creates the opportunity Awesome Widgets to track a potential sale. The partner looks up the contact Jess Fabulous to see if Jess exists in the system. If Jess isn’t in the system, the partner simply clicks New to create the contact. No break in flow, and no time lost.

Assign Record Pages by App, Record Type, and Profile

In addition to profiles, you can now add location and record type criteria to page variations and hit your target audience. For example, by combining criteria, you can have a page that’s visible only to sales users in Canada or create a custom group geared just to that set of users.

Build Dynamic Picklists for Lightning Page Components with Apex

Now you can expose a component property as a picklist when the component is configured in the Lightning App Builder. The picklist’s values are provided by an Apex class that you create.

For example, let’s say you’re creating a component for the Home page to display a custom Company Announcement record. You can use an Apex class to put the titles of all Company Announcement records in a picklist in the component’s properties in the Lightning App Builder. Then, when admins add the component to a Home page, they can easily select the appropriate announcement to place on the page.

This is awesome and adds another layer of flexibility for design-time customization to Lightning Components. Some time soon, I’ll try using this for replacing the Object Name from a textbox in my Lightning Lookup Dropdown Component to a dropdown list with all usable Objects in the org.

Customize How Related Lists Display on Lightning Pages

We want you to get exactly what you want on your Lightning pages. Instead of displaying all the related lists for a record, you now get to pick exactly which list you want with the new Related List component. This feature is new in Lightning Experience.

With the Related List component, your users can focus on the things that matter most. For example, you can use this component to display activity history front-and-center on all case pages. You can even configure this component to display a related list for a parent record. Say that you want your users to know if a case’s contact has any other open cases. Your users will never miss a beat.

External Services Wizard Walks You Through Setup (Beta)

Use External Services to connect your Salesforce org to a service of your choice. Invoke methods based on the external source via a flow. Import data from the service into Salesforce. You can do all this with the help of an easy-to-use wizard. This feature is new in Lightning Experience.

Let’s say you want to connect to a service that determines if credit is extended to a Salesforce account. You also want to know the payment terms. With External Services, you: •

1) Supply a named credential, a URL, and authentication settings. Salesforce uses this information to make callouts to the external service. •

2) Enter a schema URL path (or endpoint) or provide a complete schema.

3) Create a flow based on the Apex classes generated from your external service registration using Salesforce’s point-and-click automation tool.

This is really interesting because I haven’t heard about this capability yet. There’s an upcoming integration project on my horizon that may be able to use this so more research is needed.and this is added to my backlog.

Run Flows with a Lightning Skin (GA)

Have you ever wanted your flows to look better? So have we. When you enable this feature, all your URL-based flows render using the Lightning runtime instead of the Classic runtime. The new skin fits in with the rest of Lightning Experience, but it’s also available in Salesforce Classic.

It’s about time 🙂

Debug Lightning Components on Every Page with Lightning Inspector

The Lightning Inspector now has more debugging information such as Component information on every page and information about components that initiated actions. Debugging can be tricky so I’m glad there’s more diagnostic information to use if needed.

Bulk API Now Supports More Complex Queries

Bulk queries now support the queryAll operation and SOQL relationships.

queryAll returns records that have been deleted because of a merge or delete as well as information about archived Task and Event records. To make a queryAll request, set the operation field on the JobInfo to “queryall”.

YOU CAN NOW USE SOQL RELATIONSHIPS IN BULK QUERIES. That is huge and will streamline data conversions and integrations so much. This provides another enhancement to make to my Salesforce Bulk API Starter Project.

Metadata Relationships Now Support Field Definition Relationships

Metadata relationship fields for custom metadata types now let you look up field definitions. Previously, you could look up entity definitions for standard and custom Salesforce objects, but not a specific field on an object. Now, field definitions are supported as a type of metadata relationship field.

Finally comes to mind here. It’ll be nice to have true data integration among associations between records.

What Spring 17 features do you like and dislike? What do you think of the Spring release so far?