Hands on 2 – using custom labels in Process Builder

Custom labels are custom text values that can be accessed from Apex, Visual Workflow, Process Builder, and so on. The values can be translated into any language that Salesforce supports. You can create up to 5,000 custom labels in an organization, and they can be up to 1,000 characters in length. Custom labels are not only used for translation; they can also be used to store the username, password, and endpoint URL, in the case of invoking API calls for a third-party system.

For example, if you are integrating two systems, Salesforce and SAP, to sync the account information, in order to start the API calls, you will have to pass SAP integration user credentials and an endpoint URL. You will have three options to store these values:

  • Hardcoding the credentials and endpoint URL in an Apex class
    1. Using multiple custom labels to save the username, password, and endpoint URL
      1. Using a custom metadata type to store this information

      The benefit of using custom labels, compared to hardcoding the username and password in Apex, is that if the password changes in the future, you won't have to update the Apex class; instead, you can update the custom labels. This can be easily done in the production org itself. On the other hand, to update the Apex class, you have to use the Sandbox, and then migrate the changes into your production org. Using this approach, you can save time and hassle. You can also take the approach of using a custom metadata type, which is totally fine; but remember that Salesforce has put a limitation on everything. So, before starting the implementation, you should carefully design your complete process. I would suggest that you use custom labels if you want to save the credentials and the endpoint URL, as you wouldn't want to save this information in the cache. 

      Let's look at a business scenario. Suppose that Alice Atwood is working as a system administrator at Universal Containers. She has received a requirement from the management to auto-add an activated Campaign to the Sales Executive Chatter group.

      ..................Content has been hidden....................

      You can't read the all page of ebook, please click here login for view all page.
      Reset
      18.116.21.109