Until now, we have created many processes using Process Builder. It is an easy and fun experience to create processes. These processes will execute as soon as they meet a set criteria. There are some situations, however, when a business may want to bypass a process!
Please go through this article first and make sure to create it:
Pamela Kline is working as System administrator at Universal Containers. She has developed a Process (Getting Started with Process Builder – Part 42 (Auto remove a record from Chatter Groups) to auto post Opportunity details to the UC Internal Announcement Chatter group whenever an Opportunity gets created with an amount greater than $ 100,000; and also, when a related user, Opportunity Approver (Custom field), is @ mentioned in that post.
Pamela has now received a requirement to bypass this process for the system administrator. A system administrator usually creates hundreds of Opportunity every week. And therefore, business users want to avoid too many Chatter Feed generated by the Process that we created in Series 47.
Solution for the above business requirement
It is easy to bypass a Process for a single user or a profile – in this case, a system administrator – by adding a condition in your process, as shown in the following screenshot:Read the rest of this entry!
What is a Custom Metadata Type? Why should one use it? How should one use it? And, last but not least, how is Custom Metadata Type related to, or different than, Custom Object? Well, let us explore these concepts together!
Custom Metadata Type is similar to a custom object – it allows application developers to create custom sets of data, as well as to create and associate custom data with an organization. All custom metadata type data is available in the application cache. As a result, it allows efficient access to the data without the cost of repeated queries (SOQL) to a database.
Custom Metadata Type is mainly used to store information that will be frequently accessed from Apex code. Custom Metadata Type performs better than a custom object because it is available in cache; and therefore, it does not have to be queried. The other difference, which you will notice between the custom metadata type and a custom object, is the difference in the suffix. Custom Metadata type has __mdt suffix at the end of the custom metadata type, as opposed to the usual __c for custom objects. As of the Summer’17 release, custom metadata is not yet available in Process Builder. However, it is currently available in Visual Workflow.
Business Use Case
Let us start with a business use case. Pamela Kline is working as System administrator at Universal Containers. At UC they are using Chatter extensively for internal communication to manage Sales and Support. Business Users are often using Chatter to ask help from Internal Salesforce team regarding how to use some feature.
Pamela has received a requirement to auto-create a case whenever a new Chatter post (not a comment) contains a keyword word. She received a list of keyword words (almost 11 words) from her manager. Pamela’s task is to ensure that only a single case is created even if Chatter posts contain numerous keyword words.
Solution for the above business requirement
There are various ways to solve preceding business requirement. Few of them are following:
Create an Apex Trigger on the FeedItem object – We will work on this option in our upcoming Apex Series.
Use all 11 keywords in a Process Builder (On feedItem object) entry criteria and use the Create a Record action to auto-create a case. The problem with this approach, however, is that if, after few days, the business wants to add or remove a few keywords, then you have to start from scratch again.
Use Custom Setting to store the keywords and then use Process Builder to manage your logic.
Use Custom Metadata Type to store the keywords and then use Visual Workflow and Process Builder to manage your logic. Custom metadata provides the flexibility to add or remove keywords without having to change your Process definition or Flow.
List of Keywords: – Ohana; Salesforcehelp; help; TrailheaDX, MidwestDreamin, SoutheastDreamin, IndiaDreamin, TDX17, SalesforceOhana, JDF17, dreamOlé
To solve the preceding business requirement, we will take the 4th approach. We will use – (i) custom metadata type to store the keywords; use (ii) Flow to compare the keywords with the Chatter post body; and, use Process Builder to launch the Flow. Perform the following steps to solve the preceding business requirement:
To create a new custom metadata type, navigate to Setup (Gear Icon) | Setup | PLATFORM TOOLS | Custom Code | Custom Metadata Types and click on the New Custom Metadata Type button. Now fill the form as mentioned in the following screenshot: