RLS approval is an aura component with a lightning button named "My Approvals" that directs you to the My Approvals page. Using Lightning App Builder, you can add this component to any object's record detail pages.

Prerequisites:

  1. Basic Knowledge of using Salesforce Developer Console. For more information, see Using the Developer Console
  2. Update the APTS_RLPInstanceSettings admin setting with the approvals endpoint URL, https://<connected_environment>/approvals/. The endpoint URL is specific to the environment you are connected to.
    For the QA environment: https://rls-qa.congacloud.io/approvals/.
  3. Create an apex class, such as RLSApprovalsHandler.cls. All required profiles should be granted access to this new class.
  4. Create an aura component, such as RLSApprovals.cmp

  5. Include the component on the detail page of the record.

To create an apex class:

  1. Log in to Salesforce > click the setup () icon > Developer Console. A developer console page is displayed.
  2. Click File > New > Apex Class. 
  3. Enter the name of the Apex class as RLSApprovalsHandler and enter the following code.

    public with sharing class RLSApprovalsHandler {       
        @AuraEnabled   
        Public static String getSessionID(){
    		return UserInfo.getSessionId();
        }
    }
    CODE
  4. Click File > Save.

To create an aura component

  1. Log in to Salesforce > click the setup () icon > Developer Console. A developer console page is displayed.
  2. Click File > New > Lightning Component. 
  3. Enter the Name as RLSApprovals.
  4. Add required configurations to the new component available under the component configuration.
  5. Click Submit and enter the following code.

    <aura:component controller="RLSApprovalsHandler" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction,force:hasSObjectName" access="global" >    
        <aura:attribute name="sObjectName" type="String" />
        <aura:attribute name="recordId" type="String" />
        
        <div style="border: 1px solid lightgray; padding: 5px; margin-bottom: 10px; border-radius: 5px;background-color:white">
            <div style="margin-left: 7px; margin-bottom: 7px; color: black; font-weight: 700; font-size: 16px;">
                <span>
                    RLS Approvals
                </span>
            </div>
            <div class="full forcePageBlockSectionRow">
                <p class="full forcePageBlockItem forcePageBlockItemView" style="width:100%;text-align:center">
                    <div class="slds">
                        <div class="slds-grid slds-wrap">
                            <div class="slds-col  slds-size_1-of-12 ">                            
                                <a aura:id="myapproval" onclick="{!c.callMyApprovals}" class="HideLine">
                                    <lightning:icon iconName="standard:approval" size="medium" alternativeText="Approvals"/>
                                    <br/> 
                                    <span class="osOutputLabel">My <br/>Approvals</span>
                                </a>
                            </div>
                        </div>
                    </div>
                </p>
            </div>
        </div>  
    </aura:component>
    CODE
  6. Click File > Save.
  7. The RLSApprovals component details are displayed in the right pane. 
  8. Click CONTROLLER. An RLSApprovalsController tab is displayed. Enter the following code.

    ({        
       callMyApprovals : function(component, event, helper) {
            helper.callMyApprovals(component);        
        }   
    })
    CODE
  9. Click File > Save.
  10. From the RLSApprovals right pane, click HELPER.

    ({   	
        callMyApprovals : function(component, event, helper) {
            var recordId = component.get("v.recordId");
            var sObjectName = component.get("v.sObjectName");
            // the below URL needs to be changed according to the environment of testing. eg: rlsstg, rlsqa..
            var redirectUrl = "https://rls-dev.congacloud.io/approvals/my-approvals";
            var coreApps= component.get("c.getSessionID");
            coreApps.setCallback(this, function(response) {
                var state = response.getState();      
                if (state === "SUCCESS") {
                    var params = {};
                    var sessionId = response.getReturnValue();
                    params.sessionId = sessionId;
                    params.recordId = recordId;
                    params.sObjectName = sObjectName;
    				params.url = redirectUrl;
                    this.navigate(component, event, helper, params);
                }
            });
            $A.enqueueAction(coreApps);
        },  
        navigate : function(component, event, helper, params) {
            var urlEvent = $A.get("e.force:navigateToURL");
            urlEvent.setParams({
                "url": params.url+'?recordId='+params.recordId+'&sObjectName='+params.sObjectName+'&sessionId='+params.sessionId
            });
            urlEvent.fire();
        }
    })
    CODE
  11. Click File > Save.

To include an RLS Approval component on a Salesforce object:

  1. Log in to Salesforce > Go to Setup > Object Manager.
  2. Click Quote/Proposal. A quote/proposal object details page is displayed.
  3. From the left pane, click Ligthing Record Pages. A quote proposal record page is displayed.
  4. Click Edit.
  5. From the left pane, drag and drop RLSApprovals (available under the Custom list) to the right pane.