Salesforce Admin · Salesforce Basic · Security Model

Apex Sharing in Salesforce

There will be some scenarios in organization where you want to share a record based on some complex scenario, but you cannot define the complex scenario as a criterion in sharing rule. Then the question is how you can share a record, of course you can share them manually. But how many times you can share records manually, trust me its annoying to share records manually again and again.

Salesforce provides another way to share a record and that is through apex code via share object. So what is Share object? Every standard and custom object will have a share object in salesforce with predefined fields as shown below.

  • Standard Object’s Share object will be “sObject+Share”. For example, Account objects Share Object is AccountShare. Similarly, Opportunity objects Share object will be OpportunityShare.
  • Custom Object’s Share object will be “CustomObjectName + __Share”. For example, if your custom object name is MyCustomObject, then its API name will be MyCustomObject__c and share object will be MyCustomObject__Share.
Continue reading “Apex Sharing in Salesforce”
Salesforce Admin · Salesforce Basic · Security Model

Sharing Rules in Salesforce

There will be some scenarios where all records are privately owned, you want to share records based on some criteria with a specific user or group of users or to specific role. In such cases sharing automation should work on all records of that object. You can build a sharing rule which will handle such situation.

Consider a scenario where records should be shared based on continent field and those records should be shared with people of specific group or role. You can simple create sharing rules for each continent and share according to business requirement.

Continue reading “Sharing Rules in Salesforce”
Salesforce Admin · Salesforce Basic · Security Model

Role Hierarchy in Salesforce

An organization where there are many employees, each employee is designated with a specific designation or role. Many employees report to a person who is above their designation. Like in a IT industry where we have designations like, Software Engineer, Senior Software Engineer, Module Lead, Tech Lead, Manager, Director etc. Where Software Engineer and Senior Software Engineer will report to a Module Lead or Tech Lead. Similarly Module Lead and Tech Lead will report to Manager and so on.

A screenshot of a cell phone

Description automatically generated
Roles Section in Salesforce. Top of the tree is the Name of the Company.
Continue reading “Role Hierarchy in Salesforce”
Salesforce Admin · Salesforce Basic · Security Model

Permission Sets in Salesforce.

Let us assume that in your organization you have multiple users, let us say few are assigned to Marketing Agent Profile, some assigned to Marketing officers Profile. Marketing Agent Profile is more restricted compared to Marketing officers Profile. You know that there is a user who is in Marketing Agent’s profile who is performing better, and you want to assign him some additional permissions.

Permission sets have similar options that are in profiles, then question is why permission set when we have profiles. permission set is a collection of settings and permissions that give users access to various tools and functions. The settings and permissions in permission sets are also found in profiles, but permission sets extend users’ functional access without changing their profiles. You can create a permission set, give those additional access in that permission set and assign it to users who needs those additional options.

Continue reading “Permission Sets in Salesforce.”