Pages

Friday, March 23, 2018

Salesforce: Convert ID from 15 to 18 characters with Excel formula


CASESAFEID() will return 18 characters ID from original 15 characters ID, the main difference is: 15 characters ID is case sensitive, while 18 characters ID is case insensitive. The issue will arise when using 15 characters ID when your teams working in Excel for data analysis, VLOOKUP() of Excel will not work properly, as it is case insensitive, so the best is to use 18 characters ID which is case insensitive.

But, if you are not the system admin or do not have permission to create a custom field to use CASESAFEID() for case-insensitive 18 characters ID, you can copy and paste the 15 characters ID using this online tool from admin booster to produce the 18 characters ID.

The other option and this is very useful when you have a lot of rows in Excel that needs to convert the ID from 15 to 18 characters is to use Excel formula. The formula below is copied from Salesforce developer forum, just change A2 with the excel cell of 15 characters ID.

=CONCATENATE(A2,
MID("ABCDEFGHIJKLMNOPQRSTUVWXYZ012345",(
IFERROR(IF(FIND(MID(A2,1,1),"ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,1,0),0)
+IFERROR(IF(FIND(MID(A2,2,1),"ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,2,0),0)
+IFERROR(IF(FIND(MID(A2,3,1),"ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,4,0),0)
+IFERROR(IF(FIND(MID(A2,4,1),"ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,8,0),0)
+IFERROR(IF(FIND(MID(A2,5,1),"ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,16,0),0)
+1),1),
MID("ABCDEFGHIJKLMNOPQRSTUVWXYZ012345",(
IFERROR(IF(FIND(MID(A2,6,1),"ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,1,0),0)
+IFERROR(IF(FIND(MID(A2,7,1),"ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,2,0),0)
+IFERROR(IF(FIND(MID(A2,8,1),"ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,4,0),0)
+IFERROR(IF(FIND(MID(A2,9,1),"ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,8,0),0)
+IFERROR(IF(FIND(MID(A2,10,1),"ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,16,0),0)
+1),1),
MID("ABCDEFGHIJKLMNOPQRSTUVWXYZ012345",(
IFERROR(IF(FIND(MID(A2,11,1),"ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,1,0),0)
+IFERROR(IF(FIND(MID(A2,12,1),"ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,2,0),0)
+IFERROR(IF(FIND(MID(A2,13,1),"ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,4,0),0)
+IFERROR(IF(FIND(MID(A2,14,1),"ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,8,0),0)
+IFERROR(IF(FIND(MID(A2,15,1),"ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,16,0),0)
+1),1))


ReferenceFormula Field: calculating the 18-digit ID from the 15-digit ID



Wednesday, March 21, 2018

Salesforce: Call Flow from Action

If you check this blog again Global Actions in Lightning, Action Tyle = Flow only available in Object-Specific action, and not in Global Action. In this blog, we will share how to call Flow from an action, but will not share the basic on how to create action or how to create flow.

Use case: to increase efficiency, business users of Universal Container request the ability to update Number of Employee of Account directly from Opportunity screen.

Solution: create a flow and call it from Action.


1. Create Flow
Make sure the flow must be active and have screens, so it can't be Autolaunched Flow. Flow actions let you pass the value of the record's ID field into the flow, but that's it. Your flow needs to have a variable with Text Input called recordId, the action passes the record's ID into that variable at runtime.

see all items in Explorer panel

1st box - to get Account Id. Remember this Flow will be located in Opportunity so the variable "recordId" will return would be Opportunity Id, not Account Id. In short, this box is to query Account Id from Opportunity object.

2nd box - to get Account Name and Number of Employee. Use Account Id return from 1st query to retrieve Account Name and Number of Employee from Account object.

3rd box - in this box, the user will enter Number of Employees to update into Account, but to make it nicer, we can display Opportunity Id, Account Id, Account Name, and pre-populate Number of Employee in the textbox for user to update.

4th box - this box will save Number of Employee from screen to Account object.


2. Create Action
Create new Action with Action Type = Flow.
Select the Flow created in step 1.
Add the action to "Salesforce Mobile and Lightning Experience Actions" panel in Opportunity Page Layout, in Lightning this action will become a button, while in Salesforce mobile app it will become an icon in action bars.



3. Showtime
Now open an opportunity, you should notice a button called "Update Acct Employee".
Click the button, it will show Account Id, Opportunity Id, Account Name and pre-populate existing Number of Employee from Account.

Lightning Experience

Salesforce mobile app


I am not sure if this is a good use case because you can get something almost similar using action type "Update a Record", check this blog Update Parent Record with Action, but if your screen have logics that need query, or with multiple screens, a single "Update a Record" action will not able to  handle it, calling a Flow from an action would be a better options.


Reference:
- Update Parent Record with Action
- Global Actions in Lightning
- Flow Action Considerations
- Launch a Flow from an Object-Specific Action



Tuesday, March 20, 2018

Salesforce: Mobile Smart Actions

Mobile smart actions are quick actions that are available for Account, Case, Contact, Lead, Opportunity, custom object page, and also in the global publisher layout. The purpose of this action is only for Salesforce mobile app. Mobile smart actions don’t appear in the full Salesforce site, regardless of which page layouts you add them to, they appear only to users in the Salesforce mobile app.

Mobile smart actions appear as a single action element in the page layout editor. However, they appear as many actions in the action bar in the Salesforce app. The bundle of actions element is varied on each supported object, example: you will see New Opportunity in Account, but not in Contact. You can refer all actions available in Mobile Smart Actions from this document.

You can’t change which actions are included as part of a mobile smart actions bundle, example: you would like to remove New Event action from Case, the solution for this is to remove Mobile Smart Actions, then add the individual actions in the object page layout or Global Publisher layout.

If you have the individual action such as New Task in Salesforce Mobile and Lightning Experience Actions page layout for Account, then you also have Mobile Smart Actions for the same Account layout, New Task will appear twice in the Salesforce mobile app, but only one New Task in Lightning Experience.

New Task appears twice in mobile app


New Task appears only once in Lightning


ReferenceMobile Smart Actions


Wednesday, March 14, 2018

Salesforce: Quick Create Record with Flow

First, this blog is not related to infamous Quick Create record that does not honor validation rules, vote this idea Enforce validation rules on Quick Create records by SteveMo.

In the previous blog Update Parent Record with Action, we shared about using Action to quickly update certain fields of the parent object. This blog is the opposite direction, we would like to quickly create child record from a parent layout, example: create Contact from Account page.

Instead of using Action, for this requirement, I'll use Lightning Page + Lightning Component + Flow, there will be no script involved to build this. Let's get this started:

1. Create Flow
Navigate to Setup, find Flows menu and click New Flow button

(a) Add Variable
Add a variable to capture Account Id, we will pass the Account Id from Account record page. Make sure to select correct Input/Output Type.



(b) Add Screen for Data Entry
Add a screen to capture fields needed, such as First Name, Last Name, and Email. You can set any fields as mandatory fields, and add help text.



(c) Add Record Create item
Add Record Create item to select Object and fields value populated from screen input fields or from variables. In my case, Account Id value will be passed from Account record page to variable Account Id, then to the Record Create item.



(d) Add Screens for success and error handling
You do not want to let your users see the ugly error message, so you can create a screen to display error exception message.

Here is the overall Flow:


Close the Flow and remember to activate it.


2. Edit Account Lightning Page
Navigate to  Setup | Object Manager | Account | Lightning Record Pages.
Click the page, then click Edit button.


3. Add Component
From Standard components available in the Component panel at the left, drag Flow component into Lightning Page.



4. Select the Flow
Select component added and change the values, change Flow value with the Flow created in step-1, notice the variable appeared below and tick Pass record ID into this variable, this will pass {!Record.Id} to the variable name defined in Flow.



5. Showtime
Now, open an Account check the Flow component added. You can add Contact and the contact will automatically link to the Account.



I am not sure if this is a good use case because you can get something almost similar using object-specific Action and add it to the page layout. But, if you have a more complex flow, like involving query to other objects, and multiple screens with different screens, use Flow as Lightning Component will have more impacts.





Tuesday, March 13, 2018

Salesforce: Update Parent Record with Action

Use case: the request is to have the ability to update some fields in parent record object (such as Account) from a child record (such as Contact) page.

Before Lightning (read in Classic), you need to write a visualforce page with apex controller, then add the visualforce page into Contact page layout.

In Ligthning Experience, this becomes much simpler with Lightning Page + Lightning Component + Action, it sounds a lot, but actually, it's very simple, just a few clicks without any script involved. Let's get this started:

1. Create Action in Account
Because we are Account from Contact, the Action must be created in Account.
- Navigate to Setup | Object Manager | Account | Buttons, Links, and Actions
- Click New Action button
- Enter as the screenshot below:



2. Set Action Layout
From the action created, click Edit Layout button, remove default fields added, add fields that you would like the user to update, and click Save button. You can set the fields as Read-Only or Required, even they are not in the object itself page layout.



3. Edit Contact Lightning Page
Navigate to  Setup | Object Manager | Contact | Lightning Record Pages
Click the page, then click Edit button.


4. Add Component
From Standard components available in the Component panel at the left, drag Related Records component into Lightning Page.



5. Select the Action
Select component added and change the values, change Lookup Field value from "Use This Contact" to "Account Name", then change Update Action with action just created. See screenshot below



6. Showtime
Now, open a contact and check the component added. If you have the permission to update Account, you will be able to update Account fields from here.






Monday, March 12, 2018

Salesforce: Action in Lightning to replace URL Hacks in Classic

In Classic, many of us implemented URL hack, the purpose is to populate a value, example: populate a value from Account field into Opportunity when creating new Opportunity, but also allows the user to change it manually.

But, when switch to Lightning, URL hack will not work. In Lightning, you can implement Action to replace URL hack. Here is the step.

Use Case: to pre-populate Payment Term and Area (both are custom fields) in Opportunity when create Opportunity from Account, both fields are available in Account and Opportunity, although the field type may different.
Account:
- Area = Lookup
- Payment Term = Picklist

Opportunity:
- Area = Lookup
- Payment Term = Number

1. Create New Action in Account
Because we are creating Opportunity from Account, the Action must be create from Account.
- Navigate to Setup | Object Manager | Account | Buttons, Links, and Actions
- Click New Action button
- Enter as screenshot below (in my Opportunity, I have record type, therefore need to populate).



2. Edit Action Layout
From action created, click Edit Layout, remove default fields added, add both Area and Payment Term, and click Save button.



3. Add Predefined Field Values
Still in Action created, look for Predefined Field Values section and click New button. Select the Opportunity field name, since we have 2 fields to pre-populate, repeat this step twice.
You need to enter formula text, see screenshot below.



4. Add the Action to Account page layout
Still, in Account object manager, click Page Layouts menu, then click the Page Layout name.
Click Mobile & Lightning Actions section, then drag New Opportunity to Salesforce Mobile and Lightning Experience Actions.



5. New Opportunity
Now you should see New Opportunity button when open Account record page.



Click the button and system will popup New Opportunity action window with fields added in action layout. Both fields value should have been populated, and the user also allows to change it too.



One of the drawback when the user creates new opportunities not from the action button, e.g., from New button in Opportunity Related List, the values will be not pre-populated.


Reference: Trailhead: Create Object-Specific Quick Actions



Wednesday, March 7, 2018

Salesforce: List View Mass Action in Lightning Experience

In Spring ’18 release, Salesforce introduces Quick Actions in Lightning Experience on List View, but only applicable to Case, Lead, and custom objects only. With this user can do mass action on the selected records.

Use case: Universal Container would like to allow the Marketing team to mass update the Industry on Lead, rather than do it one by one. 

Inline editing in List View is a good option, however, inline editing does not support multiple record types in a list view, and not all fields are supported for inline editing, so creating a function to mass update would be preferred and faster.

Solution: implement Quick action for List View.

Note: this will add the button to all list views, except Recently Viewed, and you can't hide this button from a specific list view, or make the button only visible to a specific list view or user profile.


1. Create New Action
From the Setup menu, navigate to the Lead object, look for the Buttons, Links, and Actions menu.
Click the New Action button, enter/select the following values:



Add the Industry field and remove all other fields.



In some cases, you may need to Predefined Field Values for selected fields for users' productivity, but in my use case, it is not required.


2. Add button to the layout
Stay in the Lead object, click Search Layouts for Salesforce Classic menu, then click Edit under the arrow on List View. Change Industry should be available under "List View Actions in Lightning Experience"
Select the action and click the add arrow button.



3. Lead tab
Click the Lead tab, you need to select a view, such as My Unread Leads, or any list view created, except Recently Viewed. You should see the "Change Industry" button, you maybe need to click the arrow button to show more buttons available, this is because it only the first 3 buttons shown on the list page.



4. Select records
Select a list view, but not the default "Recently Viewed", then select multiple lead records, up to 200 records from the list view.
Click the "Change Industry" button, and select an industry from picklist values, this will update the industry from all Leads selected. Click the Save button, and then the OK button to confirm.



Now, all Leads selected earlier will be no longer selected and Industry value is updated.


Extra
If you would like to make "Banking" the default value, go back to your action, and set the Predefined Field Values.


Tuesday, March 6, 2018

Salesforce: Global Actions in Salesforce Classic

This blog is a continuation from previous blog Salesforce Global Actions in Lightning and Salesforce mobile app, let's take a step back where and how the same Global Actions appeared in Classic.

The use case here, customer is still in Classic, but working to migrate to Lightning by introducing Lightning for pilot or partial users, so the rest of other users still in Classic.

In Classic, Global Actions will appear in Chatter tab.



The actions available and order is following "Quick Actions in the Salesforce Classic Publisher"



If you notice the lower panel at above screenshot "Salesforce Mobile and Lightning Experience Actions", this mean, you can have different global actions available between Classic with Lightning and Mobile.

First, click tool icon at lower right of "Salesforce Mobile and Lightning Experience Actions" to overwrite actions available for "Salesforce Mobile and Lightning Experience Actions".



Now, you should get list of actions in "Mobile and Lightning Experience Actions" exactly the same with "Quick Actions in the Salesforce Classic". From here, you can modify available actions removing exiting actions by drag the action out of panel, or add new action available from "Mobile & Lightning Actions" panel. Let's say we have following actions for Mobile and Lightning Experience.



For users in Lightning, the below screenshot result from changed done in above Global Publisher layout. All Chatter Standard actions will be not available, and the default New Opportunity is not appeared, because this org. have record type implemented in Opportunity.




Reference:


Monday, March 5, 2018

Salesforce: Global Actions in Salesforce mobile app

This blog is a continuation from previous blog Salesforce Global Actions in Lightning, the same Global Actions added to the page layout will appear Salesforce mobile app in Chatter and Today page.

Side note: since Oct 2017, Salesforce1 mobile app has been renamed to Salesforce.

We will use the same page layout with global actions added in the previous blog for Lightning. From below screenshot, the actions in yellow are shown in Lightning, while the actions in green are Standard Chatter actions.



Let us see how they appear in Salesforce mobile app.



Now, we see all actions in Salesforce mobile app, including Standard Chatter actions: Post, File, Link, Poll, Question, and Thanks.

All other actions are shown in Lightning also available in Salesforce mobile app. The same for New Account action, because this org. have record type for Account, this default action will not show in the mobile app too, we cannot select record type when creating a record using Action.


Reference:



Salesforce: Global Actions in Lightning

Global Actions not only can be used in Salesforce mobile app and Salesforce for Outlook but also in Lightning experience. Global actions are intended for users want to do something quickly, one of the actions is to create object record quickly, but the new record will not auto relate with other records, such as when creating Contact for Account, the user need to manually select the Account from New Contact action layout.

Global Actions in Lightning experience appear at the top right in the "+" icon.



How/where above actions are defined?
In the setup menu, search for Global Actions, and select Publisher Layouts, you will see one or many layouts here (many if other admins have create it), if you have many layouts, you can assign the different layouts to different profiles. Within the layout, you can define the actions available and the order of actions.

Below screenshot is the layout setup for above screenshot of global actions in Lightning. If you realize, only the one in yellow highlight appears in Lightning experience.


By default, "Salesforce Mobile and Lightning Experience Actions" will follow "Quick Actions in the Salesforce Classic Publisher", if that is not overwritten.


Why fewer actions are shown in Lightning compare with actions added in the page layout?
Post, File, Link, Poll, Questions, and Thanks are Chatter actions, they will be not shown in Lightning.
New Account in this scenario is not shown in Lightning Global Actions, this New Account is default Global Actions provided by default, but since this org. have record type for Account, therefore it will not show, we cannot select record type when creating a record using Action.

New Account 1 and New Account 2 are custom actions added in Global Actions, but with the populated record type, so they appear in the Lightning Global Actions.



Side note: if you notice there is a checkbox "Chatter Feed Item", if this is enabled, when the user creates the record from Action, there will be Chatter Post for the record. 



Now, let's login as other users with lesser permissions.


Compare with the 1st screenshot, this user only allows to create new Note and Account with Record Type = Normal (see 3rd screenshot). Available actions will be auto adjusted as per user permissions defined in Profile and Permission Set. This user does not have permission to create Task, Event, Contact, and Account with record types = Not-Normal.


Action Type in Global Actionwhat action can do in Global Action?



Action Type in Object-Specific Action let's compare what action available in object-specific actions



In Global Action, we have additional action types which are not in object specific action:
- Send Email
- Custom Canvas

While in object specific action, we also have additional action types which are not in global action:
- Update Record
- Flow


Reference:


Saturday, March 3, 2018

Salesforce: Out of Office

Salesforce introduces Out of Office feature in Chatter since Winter '18 release, but this is available only in Lightning. This is pretty similar when you set out of office message in email, but this is within Salesforce platform.

This feature needs to be enabled from Setup menu, looks for Chatter Settings, scroll down to Out of Office section, then enable Users can set Out of Office messages.



Once this enabled, all users can go to their Chatter profile, by clicking their icon in the top right area, then click their name, to enable and set their Out of Office Start Date, End Date, and custom Message.

click icon -- name


set Out of Office


Once the message set, within the start and end date, message display prominently next to the user name in Chatter.

The messages will be auto removed after their end date, no need to remember to turn it off. The message also shows in many more places, such as @mention in Chatter Post, when other users hover the username in Salesforce record, and etc.




ReferenceTake a Guilt-Free Vacation with Out of Office




Page-level ad