What you need to know: Skuid and Salesforce Approval Processes

SUMMARY: Skuid respects Salesforce Approval processes.You can use custom rendering to show different components to users based on where a record is in the approval process. The Action Framework includes approval process actions.

Does Skuid respect Salesforce Approval Processes?

Yes. When records are locked for approval, your Skuid pages will display as normal. If users who don’t have permission to edit locked records attempt to save changes to a record, they will get an error message.

System administrators and other users you specify can still edit records that are locked for approval. For more information, see Salesforce’s documentation: Specify Who Can Edit Locked Records.

Best Practices for Approval Processes

  1. Skuid allows you to create highly customized pages and processes for Salesforce approvals based on your custom business logic. Here’s how: [Access approval process actions via the Action Framework](https://docs.skuid.com/latest/en/data/salesforce/#approval-process-actions)
  2. Surface approval details via Skuid models
  3. Use display logic to hide and show components based on approval status

1. Access approval process actions via the Action Framework

In the Action Framework choose Run data source action. For Salesforce objects where you’ve configured approval processes, the following options will be available:

  • Submit for Approval
  • Approve(Only an assigned approver or a Salesforce admin can approve a record.)
  • Reject (Only an assigned approver or a Salesforce admin can reject a record.)
  • Recall(Only the submitter or a Salesforce admin can recall a record.)
  • Unlock Record(Only Salesforce admin can unlock a record.)

2. Surface approval details via Skuid models

Because Salesforce stores approval history in standard objects, you can access approval data via Skuid models. Cool, right?

Two of these approval process objects are Process Instance and Process Instance Work Item. Each time a record is submitted for approval will be reflected as a Process Instance record which is linked to the parent record by the TargetObjectId field.

A model like the one shown in the screenshot above will return the approval history for a particular record.

The Process Instance Work item object is used for pending approval requests (Salesforce documentation: ProcessInstanceWorkitem).

3. Show a message to users notifying them when a record is locked for approval

Once you’ve created models tapping into the approval process, you can use Skuid display logic
to show or hide components based on where a record is in the approval process. For example, if your ProccessInstanceWorkItem model has rows, indicating that there’s a pending approval process for the record, you can:

  • Show a component in read-only mode
  • Show the user a message informing them the record is locked for approval
  • Show approvers buttons allowing them to Approve or Reject the record
  • Hide the submit for approval button
  • Hide a component in edit mode

This screenshot below shows an Approve button (using the actions described in #1) that only displays if two conditions are met:

  1. The CurrentWorkItem model (on the ProcessInstanceWorkItem object) has rows, meaning that there’s a pending approval process.
  2. When the ActorId from that ProcessInstanceWorkItem is the Id of the User running the page, meaning that the user running the page has the authority to approve the record

See it in action

Download this sample page from the Skuid page repository. This page shows how to display approval history for a particular record along with the details about pending approvals. It also uses Salesforce data source actions to enable the various approval actions and custom display logic to determine when these buttons are visible.

Note: This page requires an approval process on the Case object. If you don’t have one, we recommend you create one in a test sandbox.

Documentation

Get help with an issue

  • Ask in the Skuid user community in the questions category.
  • If you have paid support, ask your question on our support portal skuid.freshdesk.com.
  • If you’re interested in support, contact your Account Executive.
2 Likes