Technical Tips

How to Get Salesforce API Usage Report?

#1MinuteTip Here is how you can get a report on Salesforce API Usage. This will be helpful if you are reaching your API allocation limits and want to find out what is causing this.

This is an out of the box report provided by Salesforce. This report provides data by user and for last 7 days only. If you need a comprehensive report, you will need to subscribe to “Event Monitoring”, which is available at additional cost.

1. This report is available in Salesforce Classic Interface and is not yet available in Lightning Experience. So switch to Classic Interface. Click on your image -> “Switch to Salesforce Classic”

Switch to Salesforce Classic Interface

2. In Classic Interface, navigate to Reports -> “Administrative Reports” folder -> Click on “API Usage Last 7 Days”

navigate to Reports -> "Administrative Reports" folder -> Click on "API Usage Last 7 Days"

3. And the report will show you the APIs call count by user and by day of week.

Salesforce API Usage Report for last 7 days

References & Useful URLs

How to Pass the Entire Record to recordId in Salesforce Flow?

#1MinuteTip Do you know that you can pass the entire record to recordId resource/variable in Salesforce Flow? All you need to do is to define the data type of the resource as “Record”.

If you weren’t aware of this, then the chances are that you were using “Get Records” element to get the entire record. Well, now you don’t need to do that anymore and make your Flow more efficient.

“recordId” is a special resource in Salesforce Flows that automatically receives the value of the current record Id. For example, if you want to invoke the flow from an “Action” button on an object, there isn’t a way to pass any value to the Flow. In this case if you define a resource of “recordId” in the Flow and mark that as “Available for input”, Salesforce will automatically pass the record Id of the current record to this resource in the Flow.

And if you define this resource’s data type as a “Record”, the entire record will be passed to the variable. Here is an example.

1. Here is screen flow where I have defined the resource “recordId”. Note that the data type of the resource is “Record” and object is “Account”. The resource has been marked as “Available for input”

Resource recordId with data type as Record, object as Account. Check the box Available for Input

2. In this screen flow, I have defined a screen component of “Display Text”, that just shows the value of the different fields of the resource defined above. This is to validate that the entire record value is getting passed to the resource “recordId”

Display Text Component in Screen Flow showing value of recordId fields

3. Next, I have defined an “Action” on Account object and calling the screen flow from this action. As you can see, there is no option to pass any value to the screen flow from action.

Action defined on Account object calling screen flow

4. When I call the screen flow from the “Action” button from an Account record, Salesforce will automatically pass the current record to the “recordId” resource in the flow. This happens automatically behind the scenes. And now, I can see the value of the different fields of the “recordId” variable as defined in the screen flow.

Output showing the value of different fields of recordId resource

How to Get the Length of a Standard Field in Salesforce?

#1MinuteTip MuleSoft Here is how you can get a standard field’s length in Salesforce. There are other mechanisms too, but this one will probably be the simplest.

1. Click on Gear icon -> Right click on Developer Console -> Click Open Link in New Tab

Click on Gear icon -> Right click on Developer Console -> Click Open Link in New Tab

2. Click on Debug -> Open Execute Anonymous Window

In Developer Console Window, click on Debug -> Open Execute Anonymous Window

3. Type the following command, check Open Log and click Execute. Replace the highlighted part of the code with the API name of the object and field that you want to get the length of.

System.Debug(Case.Subject.getDescribe().length);
Type the following command, check "Open Log" and click "Execute"

4. In the log window, check “Debug Only” and the value that appears to the right of “DEBUG | ” is the length of the field.

In the log window, check "Debug Only" and the value that appears is the length of the field.

How to Change Values Displayed in Lookup Field in Salesforce

#1MinuteTip In Salesforce, when you click on a lookup field, there are two values that are displayed. The “Name” field of the lookup object and a second field. So, how do you change the 2nd value displayed in lookup field?

For example, when you create a case and click on the field to add the contact, it will display the Contact Name & Account name like the image below.

Values displayed in lookup field in Salesforce

The information displayed as the 2nd value comes from 2nd column defined in the Search Layouts -> Default Layout on the object as shown below.

Object Search Layout -> Default Layout controls the information displayed in lookup field

To display a different value, change the 2nd field in the Default Layout. Liked I have changed it to Phone.

Change the 2nd field in the search layout, default layout

And now, phone will be displayed as the 2nd value in the lookup field for Contact.

The second value in the lookup field will be displayed based on search layout default layout

To display multiple values, you can create a formula field and set that as the 2nd column in Search Layouts -> Default Layout. I created a formula field of text type to concatenate Email & Phone on the Contact object and added that field as 2nd column in Search Layouts -> Default Layout. And now the lookup field shows the value as shown below.

Use formula field to display as second value in lookup field

IMPORTANT: Do note that not all the field types can be displayed as the 2nd value in the lookup field. For example, if you set the field type “Email” as 2nd column in search layout, it won’t be displayed in the lookup field. In that case, 3rd column from the search layout will be displayed. Do take a look at the Salesforce help article below to see those exceptions.

References & Useful URLs

Scroll to Top
Introducing All Access Pass