Posts

Retrieve Top Level RoleIds, Role Names And Below RoleIds,Role Names in Salesforce

Image
Below code is to fetch Top Level RoleIds, Role Names And Below RoleIds,Role Names based on given user. To achieve the requirement, a batchable and a iterable have been written. here is the code for batchable class. Through this code, IC_UserRole_Hierarchy__c object record gets inserted. This object has various fields like Role Above Current User Role,Role Below Current User Role,Role Ids Above Role,Role Ids Below Role,Current User Role,Current User Role Id. When batch runs and current user value is passed then it will insert the IC_UserRole_Hierarchy__c  record having all the information about above and below roles of a user. public class InvestCloudRoleHierarchyBatchable implements Database.Batchable<User>, Database.Stateful { //Implementation Batchable.Start method //Method to get the Set of Users of specified Roles public String userId {get; set;} public InvestCloudRoleHierarchyBatchable (String userId){ this.userId = userId; ...

Salesforce Lightning - How To Fire Component Event

Component Events  can be fired from the same component. It is used to communicate data to another component. Component events are divided into two sections  <aura:registerEvent> ( In this section, we can register the event) and   <aura:handler> (In this, we can handle the register event).   Usually, one component is interested in the event, as an event aggregator. We can create a   custom component   event by using this tag <aura:event> in a .evt resource. In component events, we can take the type attribute value as   ‘COMPONENT’   inside the <aura:event> tag. Example:  componentEvent.cmp < aura:event type = "COMPONENT" description = "Component Event template" > < aura:attribute name = "recordByEvent" type = "sObject" /> </ aura:event > To fetch the attribute value from this event, we can call event.getParam(" recordByEvent ") in the handler’s client-side controller.   Let’s start th...