Pages

Sunday, March 26, 2017

Salesforce Lightning: Customize Fields on Recently Viewed List


When you click a tab in Salesforce, you will see default columns / fields from records recently viewed. For most list views, your users can select which fields to display and how to order the view columns. However, they can’t edit the recent records quick list on object home pages. Only Salesforce admins can select and order the fields to display for the recent records view.

In Classic, to modify fields displayed in the Recently Viewed List on Object home pages, navigate to Setup | Customizeobject name | Search Layouts, click the object name Tab, you can select fields would like to show in the Recently Viewed List. You can order columns by selecting one or more fields from Selected Fields and clicking Up or Down.

If you are familiar with the step in Classic, this is different in Lightning Experience. If you follow above steps, the Recently Viewed List on Object home pages will not change. So, follow this steps:
  1. From Setup, enter Object Manager in the Quick Find box, then select Object Manager.
  2. Click the label name of the object for the Recently Viewed list you want to modify.
  3. From the menu of links at the top of the page, click Search Layouts.
  4. In the far right of the Search Results column, click arrow icon and select Edit.
  5. To add columns to the Recently Viewed list, select one or more fields from Available Fields and click Add. To remove columns, select one or more fields from Selected Fields and click Remove.
  6. Order columns by selecting one or more fields from Selected Fields and clicking Up or Down.
  7. Click Save.


ReferenceSelect Fields to Display in the Recently Viewed List on Object Home Pages in Lightning Experience



Sunday, March 19, 2017

Salesforce: VLOOKUP


Some of us, Salesforce admin, maybe familiar with the popular VLOOKUP() function in Ms Excel from our previous job. But how about VLOOKUP() function in Salesforce? Yes it is exist, but not really very similar. VLOOKUP() in Salesforce able to retrieve a field based on a key data, so they are still not too much different, but in Salesforce, until now Spring 17 release, it only for validation rule, while ideally this should be expand to Workflow and Formula Field, vote for this formula in Ideaexchange.

Here is the fact:
1. This function is only available in validation rules, not in formula field, workflow and so on, see this blog Functions versus Rules matrix.

2. Syntax: VLOOKUP(field_to_return, field_on_lookup_object, lookup_value).

3. The field_to_return must be an auto number, roll-up summary, lookup relationship, master-detail relationship, checkbox, date, date/time, email, number, percent, phone, text, text area, or URL field type.

4. The field_on_lookup_object must be the Record Name field on a custom object.

5. The field_on_lookup_object and lookup_value must be the same data type.

6. The value returned must be on a custom object.

7. You cannot delete the custom field or custom object referenced in this function.


Scenario: when save on Account, system should check if the competitor is correct by looking number of branches.

Solution: create a validation rule with VLOOKUP() function.
Number_of_Locations__c <=
VLOOKUP(
$ObjectType.Competitor__c.Fields.No_of_Branches__c, $ObjectType.Competitor__c.Fields.Name,
Name
)

This function will return No_of_Branches__c from Competitor__c object, based on Name field from Account (you can replace Name here with a custom_field__c) and compare with Name field from Competitor__c object. Number_of_Locations__c and No_of_Branches__c must be in the same field type.

If VLOOKUP() cannot find the competitor name, it will skip the validation rule, and the lookup value is not case sensitive.


ReferenceFormula Operators and Functions I–Z




Friday, March 3, 2017

Salesforce: Lightning Login with Fingerprint

In my earlier blog Introducing Lightning Login, we discussed about how to setup Lightning Login, but many of you ask why I do not see fingerprint option, if my device support it.

To use Lightning Login, your admin must first enable Lightning Login for your org., then assign you with Lightning Login User permission. Lightning Login requires Android version 5.0 (Lollipop) or later or iOS 8 or later. If you’re using an iPhone, enable fingerprint or PIN identification. To use your fingerprint on an Android phone, first set up a PIN, pattern, or password.


As you see from above flow:
1. Click—Look for the lightning bolt next to your Lightning Login–enabled username, and click your username.
2. Tap—On your mobile device, tap the notification from the Salesforce Authenticator app.
3. Touch—Verify your identity with your fingerprint or PIN. Presto! You’re logged in.

In step 3 Touch, you can use fingerprint or PIN, but we haven't see this in the earlier blog.
This is simply because as admin, you need to grant Two-Factor Authentication for User Interface Logins permission to the user, either by Profile or Permission Set.

Once this permission is added, if user have enable Lightning Login, after user tap Approve in the device, user will be asked for fingerprint.



In other scenario, if Two-Factor Authentication for User Interface Logins permission has been given and activate by user prior Lightning Login, when user Enroll for Lightning Login, user will be asked for fingerprint when they enroll.




Reference:


Wednesday, March 1, 2017

Salesforce: Introducing Lightning Login

Since Winter '17 release, Salesforce introduce Lightning Login, this has nothing related with Lightning Experience, and Lightning Login work with both Classic and Lightning Experience.

With Lightning Login, after open Salesforce login page, you just simply click your username and tap approve from your mobile device. If your phone support fingerprint, you can make this further secure by authenticate with fingerprint. So no more entering username and password, just click and approve!


How to implement Lightning Login?
Admin 
1. Activate "Lightning Login" in Session Setting.
2. Add permission "Lightning Login User" to Permission Set or Profile.
3. Assign permission to users if you use Permission Set.

User
1. Install Salesforce Authenticator in mobile app (this is the same app for 2FA implementation).
2. Navigate to your User Detail page and click Enroll link next to Lightning Login.



3. Register for Identity Verification, Salesforce will send you verification code.


4. Once verified, you need to add New Account in Authenticator app, copy the two-word phrase into Salesforce and click Connect.



5. Tap "Connect" button in the Authenticator mobile app. You will get another email from Salesforce that a new verification method was added to your account "approve notifications from Salesforce Authenticator".

6. Next, you need to Approve from your mobile app.



7. Done, Salesforce will email last email say that you've enrolled in Lightning Login, you can now log in using your username and an authenticator app instead of a password.

8. Logout and login back, make sure to tick "Remember me" checkbox, notice a small lightning icon is added next to your user photo.



Normal Login
Once all setup, here is the flow to login with Lightning Login
1. Login to Salesforce from login.salesforce.com (or your custom my domain)
2. Click your username (notice lightning icon added next to your photo)
3. Tap "Approve" button from your device with Authenticator app


How to Cancel Lighting Login?
Navigate to your User Detail page and click Cancel link next to Lightning Login and Disconnect from Salesforce Authenticator. 






Tuesday, February 21, 2017

How to run Regex in Microsoft Excel?

1. Show Developer tab in Excel ribbon
If you do not see the tab, follow this URL to enable it.
https://msdn.microsoft.com/en-us/library/bb608625.aspx


2. VBA
To run Regex in Excel, you need to use VBA (Visual Basic for Applications).
From Developer tab, click Visual Basic icon.



3. Enable Regex for VBA for the workbook
In "Microsoft Visual Basic for Applications" window select "Tools" from the top menu.
Select "References".
Check the box next to "Microsoft VBScript Regular Expressions 5.5" to include in your workbook.
Click "OK".




Use Case:
We would like to parse specific patterns from range of cells in Excel, each cell could contain 0, 1 or more matches.
Here sample of data that user enter manually over times, to a text field without a good standard:
- Monitor 2X225,32C235, 21D2251
- 21A225; or 2C235; 21Z0251 keyboard

We need to capture and parse those ID, this looks like manual job, but with regex, we can parse this automatically. Regex should work with any new modern programming language, such as: Java, .Net and etc., but since Excel support VBA, we can make use of it.

If you notice above IDs, here is the possibility of patterns:
- 9X999
- 99X999
- 99X9999

With some testing with www.regex101.com, here is the RegEx to parse it:
[0-9]{2}[A-Z][0-9]{4}|[0-9]{2}[A-Z][0-9]{3}|[0-9][A-Z][0-9]{3}

From VBA window, copy and paste following script:
 Private Sub splitUpRegexPattern()  
   Dim regEx As New RegExp  
   Dim strPattern As String  
   Dim MyRange As Range  
   Dim i As Integer  
   Dim strMatch As String  
   'Source Data  
   Set MyRange = ActiveSheet.Range("A2:A15")  
   For Each C In MyRange  
     ' Regex pattern  
     strPattern = "[0-9]{2}[A-Z][0-9]{4}|[0-9]{2}[A-Z][0-9]{3}|[0-9][A-Z][0-9]{3}"  
     If strPattern <> "" Then  
       With regEx  
         .Global = True  
         .IgnoreCase = True  
         .Pattern = strPattern  
       End With  
       Set Matches = regEx.Execute(C.Value)  
       ' Reset the variables  
       strMatch = ""  
       i = 1  
       ' Iterate through the Matches collection  
       For Each Match In Matches  
         strMatch = "'" & Match.Value  
         ' Display the matches at right columns  
         C.Offset(0, i) = strMatch  
         i = i + 1  
       Next  
     End If  
   Next  
 End Sub  

Result:


The step and script is tested with Microsoft Excel 2013 and 2016.



Sunday, February 19, 2017

Your Organization's Salesforce.com pages has moved

If your user get a splash warning message "Your Organization's Salesforce.com pages has moved. Redirecting...", what is this mean? and why this happened?



This warning message usually happened when your admin enable "My Domain" feature, but still allowed user login from https://login.salesforce.com

As admin, you can check this from Setup | Domain Management | My Domain, and look for Redirect Policy under My Domain Settings.


If Redirected to the same page within the domain is selected, users are immediately sent to the new URL, without notification.

If Redirected with a warning to the same page within the domain is selected, users briefly see a warning message before being redirected to the new URL. The warning gives users a chance to change their bookmarks and get used to using the new sub-domain URL. You can’t customize the message.

If Not redirected is selected, the user gets a “page not found” error. Eventually, you want your users to use only sub-domain URLs, but it’s a best practice to use Redirected with a warning to the same page within the domain for a short time after you deploy your sub-domain so that users can get used to the new URLs.


Reference: