Loading

Conditionally hide the Submit for Approval button in Salesforce Advanced Approvals

Publiseringsdato: Apr 9, 2024
Beskrivelse
In Salesforce Advanced Approvals (AA), best practice is to show the Submit for Approval button when the record is not already submitted for approval and hide it after the record is submitted for approval.
Løsning

The process requires new record types, page layouts, and a flow.

1. Create a new Page Layout and remove the Submit for Approvals button. Use the existing layout with the Submit for Approval button and create a new layout without it. You should now have 2 layouts: One with the Submit for Approval Button and one without.
 

2. Create new Record Types

Two new Record Types are needed.

 1.  Go to Setup | Create | Object | Quote.
 2.  Open the Quote Object | Record TypesNew.
 
 First Record type for "In Progress" Quotes  
 
 1.  Existing Record type = Master, Enter a Record Type Label, Active = Yes.
 2.  Modify permissions as needed, you could remove all permissions since this will be driven by workflow.
 3.  Pick the profile you want to apply it to.
 4.  Click Save.
 
 Second Record type for "New/Recalled/Rejected Quotes'  
 
1.  Existing Record type = Master, Enter a Record Type Label, Active = Yes.
2. Modify permissions as needed, you could remove all permissions since this will be driven by workflow.
3. Click Select the profile you want to apply it to.
4. Click Save.

Picklist values can be set per Record type. For example, only allow approval status to be certain values on each record type. Alternatively the approval status field can be made to be read only.
 

3. Create a Flow

You will need a flow with decision logic to choose which Record Type to use.

Setup | Process Automation | Flows | New Flow

  1. Object = Quote
  2. Configure Trigger = A record is created or updated
  3. Condition Requirements = Any Condition Is Met (OR)
  4. Setup 3 Conditions.
    1. ApprovalStatus__c = Recalled
    2. ApprovalStatus__c = Rejected
    3. ApprovalStatus__c = Pending
  5. Click Done
  6. Add Decision Element
    1. Fill in New Outcome Label
    2. Condition Requirements to Execute Outcome = All Conditions Are Met (AND)
    3. Resource = {!$Record.ApprovalStatus__c} "You can get to this by going to SBQQ__Quote__c and choosing Approval Status"
    4. Change Label on Default Outcome
    5. Click Done
  7. Add Update Element under Default Outcome
    1. How to Find Records to Update and Set Their Values = Use the quote record that triggered the flow
    2. Condition Requirements to Update Record = None-Always Update Record
    3. Field = RecordTypeID and Value = The Id for the Record Type that is using the page layout with the Submit for Approval button.
    4. Click Done
  8. Add Update Element under New Outcome
    1. How to Find Records to Update and Set Their Values = Use the quote record that triggered the flow
    2. Condition Requirements to Update Record = None-Always Update Record
    3. Field = RecordTypeID and Value = The Id for the Record Type that is using the page layout without the Submit for Approval button.
    4. Click Done
  9. Click Save
  10. Click Activate
  11. Test


Existing quotes will not be updated to reflect the correct record type. This can be done manually or you can mass update record types with Data Loader.

Flere ressurser
SEE ALSO
Knowledge-artikkelnummer

000384614

 
Laster
Salesforce Help | Article