Custom Mass Approval Screen In Salesforce Lightning Component

Hey guys, today in this post we’ll see that how we can create custom mass records approval screen using salesforce lightning aura component.

In this aura component we will create a lightning data table which lists out all the records submitted for approval (records which can be approved/rejected by running user).

Key Features Of Approval Component :

  • Lightning data table with column sorting
  • Display records from multiple objects
  • If approver wants to know more about records, they can click the hyperlink which will opens the record detail page in new tab.
  • Multiple/Mass Record Selection for Approve/Reject
  • Programmatically Approve or Reject record using apex
  • Dynamic component

Multi Record Approval salesforce

Apex Controller : 

Apex Summary : In apex class we have 2 @auraEnabled method :

  •  getSubmittedRecords : this method will query all records submitted for approval from ‘ProcessInstance’ standard object, next process all records in a wrapper class and return wrapper instance.
  • processRecords : this method will programmatically approve/reject selected records. and returns a success/error message string.

multiRecordsApproval.cmp [Aura Component] :  

Code Summary :

  • Invoking apex method on component load to get all record submitted for approval and display those records in lightning data table.
  • We have 2 lightning button for approve or reject record(s).
  • Check code comments 🙂

multiRecordsApprovalController.js [JavaScript Controller] :

multiRecordsApprovalHelper.js [JavaScript Helper] :

Output : 

Multi Record Approval salesforce

 

Related Resources :
Other popular Post :

Follow us for new post updates. & Don’t forget to bookmark this site for your future reference.

Facebook : https://www.facebook.com/sfdcmonkey/

Instagram : https://www.instagram.com/sfdc_monkey/

About The contributor: 

Kiran.B

4 Post Contribute

kiran b sfdcMonkey

I have 3.5 years of experience and working in lightning for the past 1 year. I am working as a developer in Deloitte.

Skills : Apex ,lightning , visualforce,sales cloud,JavaScript,Einstein analytics

 

 

Post By Kiran :

  1. Custom Mass Approval Screen In Salesforce Lightning Component
  2. How To Implement Infinity Or Lazy Loading In Salesforce Lightning DataTable
  3. How To Implement Column Sorting In Salesforce Lightning DataTable
  4. Develop a Simple To-Do List App With Salesforce Lightning Component
(Visited 13 times, 1 visits today)

Buy me a coffeeBuy me a coffee

(Visited 3,323 times, 1 visits today)

4 thoughts on “Custom Mass Approval Screen In Salesforce Lightning Component”

  1. Hi,

    Nice post. Thanks for sharing.

    I would like to display  a pop up of related record (Account) details to change it before approve/reject the approval how to do that?

    Is there anyway to add approver comments before approve/reject?

    Thanks,

    Likit

    Reply
  2. (SELECT ID FROM WorkItems WHERE OriginalActorId =:UserInfo.getUserId()),

    I got error from line number 19 from controller Method does not exist or incorrect signature: void getUserId() from the type userinfo

    Reply
  3. When you try to sort on a column for the first time it throws an error. After you close the error it will let you sort. Any ideas?

    Uncaught Action failed: c:multiRecordsApproval$controller$handleSort [helper is not defined]

    Reply

Leave a Comment