0

I have created an approval process on Quote object, the criteria is whenever a backdated policy will get created it should go through the approval process.

The process working fine, when the user click on the button " Submit for approval" only. But if he doesn't it will proceed as usual, which I need to block. How to show an on screen alert to the user e.g "The record need submit for approval", after / while saving and it shouldn't let the user proceed further until clicked on the button.

2

If you want to achieve through OOTB way, then create a checkbox like Submitted for Approval and when record is submitted then mark this checkbox as true. You can do this via workflow field update.

Create a validation rule, which will fire during Save operation to verify if this checkbox is true, otherwise show the error message The record need submit for approval.

  • Hi Santanu, Thanks. I created a Checbox and a VR. The VR is triggering during saving. But then the user cant able to proceed further to save it. We want he can save it and click the " submit for approval" button. VR rule doesn't allow to save at first. plz suggest – sourav Jun 1 '18 at 10:05
  • basically, you need to define a rule when to save it and when to allow to save after Submit for approval – Santanu Boral Jun 1 '18 at 13:26
0

Replace the standard Submit for Approval button with a custom URL button that redirects to a custom Visualforce Page. Ensure that you pass the Salesforce Record Id of the record being submitted.

The only reason you need a Visualforce page is because you may not be able to invoke Apex from a Javascript code snippet from a custom button on a standard page layout.

You can embed the logic to validate if a back dated policy has been approved or not within the Apex Controller for the Visualforce Page and have it fired as soon as the Visualforce page loads.

If the validation goes through, then submit the respective Quote record for approval using the Approval.ProcessSubmitRequest offered within the Apex Class Library.

Refer the Apex Developer Guide to learn more about the ability to invoke Approval processes through Apex.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.