Queue-Based Publishing Workflow
Series: Build a Salesforce Guide App with AI
Page: 3 of 10
Time to complete: 20–30 minutes
Prerequisites: Page 2 complete (custom objects created)
What We’re Building
The approval process controls how a guide moves from Draft to Published. The flow is:
- Author saves guide as Draft
- Author clicks Submit for Approval
- Apex sets status to Pending Approval and submits to the approval process
- Any member of the Guide Approvers queue can approve or reject
- Approval → Status becomes Published, version number increments
- Rejection → Status returns to Draft, author revises and resubmits
Admin-audience guides bypass this entirely — they publish directly via a separate button. This is handled in code (Page 9) but the approval process entry criteria needs to reflect it.
Step 1 — Create the Approver Queue
The queue is what allows any designated approver to action requests, rather than routing everything to one named person.
- In Setup, type
Queuesin Quick Find and click it - Click New
| Setting | Value |
|---|---|
| Label | Guide Approvers |
| Queue Name | Guide_Approvers |
| Send Email to Members | Ticked |
- Under Supported Objects — add Guide
- Under Queue Members — add yourself for now
- Click Save
💡 In production: Add everyone who should be able to approve guides as queue members. When a guide is submitted, any member can approve it — whoever picks it up first.
Step 2 — Create the Approval Process
- In Setup, type
Approval Processesin Quick Find and click it - In the dropdown, select Guide
- Click Create New Approval Process → Use Jump Start Wizard
Fill in:
Name & Description
| Field | Value |
|---|---|
| Process Name | Guide Publication Approval |
| Unique Name | Guide_Publication_Approval |
Entry Criteria
This is critical — set it so Admin-audience guides never enter this process:
| Setting | Value |
|---|---|
| Criteria | Criteria are met |
| Field | Guide: Audience |
| Operator | not equal to |
| Value | Admin |
Approver
| Setting | Value |
|---|---|
| Automatically assign to | Queue |
| Queue | Guide Approvers |
Click Save.
Step 3 — Add the Actions
The Jump Start Wizard creates a minimal process. You need to add several actions manually.
On the approval process detail page:
Initial Submission Actions
Click Add New → Field Update:
| Field | Value |
|---|---|
| Name | Set Status to Pending Approval |
| Field to Update | Status |
| Specific Value | Pending Approval |
Click Save.
Final Approval Actions
Click Add New → Field Update:
| Field | Value |
|---|---|
| Name | Set Status to Published |
| Field to Update | Status |
| Specific Value | Published |
Click Save, then Add New → Field Update again:
| Field | Value |
|---|---|
| Name | Increment Version Number |
| Field to Update | Version |
| Select: Use a formula | Version__c + 0.1 |
Click Save.
Final Rejection Actions
Click Add New → Field Update:
| Field | Value |
|---|---|
| Name | Set Status to Draft |
| Field to Update | Status |
| Specific Value | Draft |
Click Save.
Step 4 — Activate
Click Activate at the top of the approval process page. Confirm when prompted.
⚠️ Salesforce will warn you that the process can’t be deleted once activated. That’s fine — you can still edit and deactivate it later.
Step 5 — Add the Submit for Approval Button to the Guide Layout
The approval process is active, but users need a way to trigger it from a Guide record.
- Go to Object Manager → Guide → Page Layouts
- Click on Guide Layout
- In the layout editor, find the Salesforce Mobile and Lightning Experience Actions section
- Click the wrench icon on that section
- Find Submit for Approval in the action palette
- Drag it into the actions bar
- Click Save
Step 6 — Add Approval History to the Page Layout
In a single-user Developer Edition org, you’ll need the Approval History related list to approve your own test submissions.
- Still in the Guide page layout editor
- Find Approval History in the Related Lists palette
- Drag it onto the page layout
- Click Save
💡 Why this matters: Salesforce prevents the same user who submitted a guide from approving it via the standard notifications. In a single-user org, the Approval History related list on the record itself is how you approve your own test submissions.
A Note on Why the Apex Handles Status Changes
You might wonder why we’re setting up a field update action to set Status to Pending Approval, when the Apex code also does this. The answer is belt-and-braces:
The Apex submitForApproval() method sets Status = 'Pending Approval' via DML before calling Approval.process(). This is necessary because the approval process entry criteria checks the status — if the record is still Draft when Approval.process() is called, the process can’t find an applicable process and throws an error.
The field update action in the Initial Submission Actions section is a safety net. Both approaches are needed for the process to work reliably.
Check Your Work
- ✅ Guide Approvers queue created with you as a member
- ✅ Approval process active with entry criteria: Audience not equal to Admin
- ✅ Initial Submission: Field Update → Status → Pending Approval
- ✅ Final Approval: Field Update → Status → Published AND Field Update → Version + 0.1
- ✅ Final Rejection: Field Update → Status → Draft
- ✅ Submit for Approval button on Guide page layout
- ✅ Approval History related list on Guide page layout
Ready for the code. Move to Page 4.