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, but 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, to start the API calls, you have to pass SAP integration user credentials and an endpoint URL. You have three options to store these values:

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

      The benefits of using custom labels compared to hardcoding the username and password in Apex are that if the password changes in future, then you don't have to update the Apex class; instead, you can update the custom labels. This can easily be done in the production org itself. On the other hand, to update the Apex class, you have to do this in a 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 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 credentials and the endpoint URL as we don't want to save this information in the cache. In Chapter 7Building Applications without Code, we will look at an example of how to use custom metadata type with Visual Workflow. 

      Let's look at a business scenario. 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
      3.15.168.2