PDF
Download PDF
Download page Configuring My Approval Button on Proposal Detail Page.
Configuring My Approval Button on Proposal Detail Page
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:
- Basic Knowledge of using Salesforce Developer Console. For more information, see Using the Developer Console.
- 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/. - Create an apex class, such as RLSApprovalsHandler.cls. All required profiles should be granted access to this new class.
Create an aura component, such as RLSApprovals.cmp
Include the component on the detail page of the record.
To create an apex class:
- Log in to Salesforce > click the setup () icon > Developer Console. A developer console page is displayed.
- Click File > New > Apex Class.
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- Click File > Save.
To create an aura component
- Log in to Salesforce > click the setup () icon > Developer Console. A developer console page is displayed.
- Click File > New > Lightning Component.
- Enter the Name as RLSApprovals.
- Add required configurations to the new component available under the component configuration.
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- Click File > Save.
- The RLSApprovals component details are displayed in the right pane.
Click CONTROLLER. An RLSApprovalsController tab is displayed. Enter the following code.
({ callMyApprovals : function(component, event, helper) { helper.callMyApprovals(component); } })
CODE- Click File > Save.
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- Click File > Save.
To include an RLS Approval component on a Salesforce object:
- Log in to Salesforce > Go to Setup > Object Manager.
- Click Quote/Proposal. A quote/proposal object details page is displayed.
- From the left pane, click Ligthing Record Pages. A quote proposal record page is displayed.
- Click Edit.
- From the left pane, drag and drop RLSApprovals (available under the Custom list) to the right pane.