+ Start a Discussion

Add Cancel and Continue button in a Flow - screen


How do I add a Cancel or Continue button in a Flow -screen?

SwethaSwetha (Salesforce Developers) 
HI Sambit,
There is no out-of-the-box functionality to achieve this. We also have an Idea https://trailblazer.salesforce.com/ideaView?id=08730000000keEFAAY to have this functionality implemented. Please consider upvoting so that the product team can prioritize.

Also based on a similar ask(https://salesforce.stackexchange.com/questions/79798/can-we-provide-custom-buttons-in-a-flow-or-provide-the-ability-to-cancel-an-int) that has been posted in past, this should be possible with custom code

" add a method to your flow controller that Supports a Cancel button. Every Flow Controller always has (or has the option) to provide a redirect at the end of the flow using a method like below:
public PageReference getOID(){
    PageReference p = new PageReference('/p/opp/SelectSearch?addTo=' + getOppID() + '&retURL=%2F' + getOppID();
  return p;

Why not create a similar method to call from your Cancel button where p.setRedirect(false)? Whether you choose to call it using JS Remoting or standard VF would be up to you."

Also see David Reed's comment on  https://salesforce.stackexchange.com/questions/261532/breaking-a-flow-into-2-different-transactions/262240#262240 that elaborates on using Pause element to preserve the Flow's state

Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you