I’m still pinching myself. My new book Mastering Salesforce CRM Administrationwas out yesterday (03/27/2017). Salesforce.com is one of the fastest-growing and demanding technologies at the moment. Mastering Salesforce CRM Administration is a hands-on guide that will help Salesforce newbies (who have a basic knowledge of Salesforce), new or experienced Salesforce administrators, and developers who want to take their knowledge to the next level to become a Salesforce certified advanced administrator. As you go through the content, you will notice that this book focuses on real-world examples. This book builds upon these examples to help you understand and use the features of the Salesforce.com platform.
This book is all about mastering the Salesforce admin part, taking your skills as an administrator or developer and tuning them for the unique features of the Salesforce platform. I have discussed many complex topics in this book, such as territory management,forecasting,quota,escalation rule,knowledge base,Visual Workflow, Process Builder, deployment using Force.com Migration Tool and more. This book covers almost all the topics mentioned in Salesforce certified advanced administrator examination study guide.
Here’s a taste of what you’ll uncover:
Adopt Lightning Experience to improve the productivity of your organization’s sales team
Create and maintain service entitlements and entitlement processes
Process Builder basic and advanced concepts
Implement Customizable Forecast and quota management
Implement Knowledge base management to improve support reps productivity
Implement territory management
Exploring different ways to deploy application between environments including Force.com Migration Tool
Best practices for improving and enriching data quality
And yes, so much more.
I would like to take this opportunity to thank both of you (Jitendra Zaa and Vinay Chaturvedi) for the effort and expertise that you have contributed to reviewing, without which it would have been impossible to maintain the high standards of the book.
Vinay Chaturvedi is a Salesforce MVP, currently working as a principal consultant. He has been loving and living Salesforce since 2011.
Jitendra Zaa is a Salesforce MVP, author, and a Dreamforce speaker with more than 9 years of experience in web technologies and cloud platforms.
Salesforce allows you to control access to data at many different levels i.e. object-level, the record-level and the field-level. Here we will focus on methods for controlling access to data at the record-level. In the most of the scenario you can use Out-of-box sharing settingsto grant record access, but there are few use cases where you have to write an Apex Managed Sharing to share the records with users or groups. Apex Managed Sharing allows you to use Apex Code to build sophisticated and dynamic sharing settings that aren’t otherwise possible. In this article I will show you how can use Flowand Process Builderto solve these requirements instead of using Apex code. Let’s start with a business use case
Business Use case
Warren Mason is working as System administrator at Universal Containers (UC). Currently he is working on a project that is implementing an audit management for Assets. For this he has created a custom object Audit (OWD: – private) and few custom fields as Shown in the following screenshot:
Audit Custom Object
Now business requirement is as soon as Auditor__c (Lookup of User object) field gets populated then auto share the audit record (Grant edit access) with the auditor.
Solution for the above business requirement
There are few solutions possible for the above business scenario. We will use Flow and Process Builder to solve the above business requirement. Before proceeding you have to understand the sharing table in Salesforce. All objects that have a default sharing setting of the either “Private” or “Public Read Only” also have a related “Share” object that is similar to an access control list (ACL) found on other platforms. All share objects for custom objects are named as CustomObject__Share, where CustomObject__c is the name of the related custom object. A share object includes records supporting all three types of sharing i.e. Force.com managed sharing, user managed sharing, and Apex managed sharing. Share object contains few fields those are following
A. ParentId: – The Id of the record being shared. This field cannot be updated.
B. UserOrGroupId: – The Id of the User to whom you are granting access.
C. AccessLevel: – The level of access that the specified User or Group has been granted.
D. RowCause (aka Sharing Reasons): – The reason why the user or group is being granted access.
First of all, we will create anApex Sharing Reasons. Each Apex sharing reason has a Label and a Name. TheLabelvalue is displayed in theReasoncolumn when viewing the sharing for a record in the user interface. This allows users and administrators to understand the source of the sharing. Follow the below instructions to create a Flow and Process Builderto solve the above business requirement
1. To create Apex Sharing Reasons click on Setup | Build | create | Objects | Audit then navigate toApex Sharing Reasonsrelated list and click on theNewbutton
Apex Sharing Reasons
You can enter any words or phrase for Apex Sharing Reasons. The next step is to create aFlow.
2. Click on Setup | Build | create | Workflows & Approvals | Flows 3. Click on New Flow, it will open the Flow Canvas for you. Create two text variables VarT_AuditId and VarT_AuditorId as Shown in the following screenshot
4. The next step is to create a record on the Audit_Share object to share the record with the auditor at the run time. For this drag-and-dropRecord Create Element (Give the nameShare audit record with Auditor) on the Flow Canvas and fill the details as shown in the following screenshot
Record Create – Create an Audit_Share record
Once you are done click on OK. Finally, yourFlowwill look like the following screenshot, click on icon that mark in red to set as startpoint
5. Save your flow with nameShare record with auditor and close the canvas. Don’t forget to Activate the Flow.
Launch a Flow from Process Builder
Our next task is to create a Process onAudit object to launch a Flow. To create a Process on theAudit object follow the below instructions
1. Click on Name | Setup | App Setup | Create | Workflows & Approvals | Process Builder and click on the New button, Enter Name, API Name and click on the Save button 2. Click onAdd Object, selectAudit object and for the entry criteria, Select when a record is created or edited, as shown in the below screenshot and also click on theSave button
3. The next task is to add ProcessCriteria, To do this click on Add Criteria, enter Name, Type of action and set filter conditions (In this case set [Audit__c].Auditor__c Is null False) and click on theSave button, as shown in the following screenshot
4. Our final task is to add Immediate action to Process. Click onAdd Action (Under Immediate actions), Select the type of action to create (In our case Flows), and then fill out the fields to define the action, as shown in the following screenshot
Add action – Flows
5. Once you are done, click on theSavebutton, it will redirect you to Process canvas. Finally, theProcesswill look like the following screenshot
Don’t forget to active the Process by clicking on theActivatebutton
It’s time to test this App
Now onwards if a business user creates an audit record with auditor then Process Builder will automatically trigger and Launch the Flow then it will share the audit record with the auditor.
1. Currently audit “Dell PowerEdge Tower Servers” doesn’t have an auditor, as shown in the following screenshot
Audit record before update
2. Now update the audit record with valid auditor, as shown in the following screenshot
Audit record after update
3. To verify the outcome click on thesharingbutton available on the record detail page and check out the sharing detail as shown in the following screenshot
Note: – I will suggest you to implement this first on your developer org test it and then move it to Production.