You need to sign in to do that
Don't have an account?
phiberoptik
Custom JavaScript Button to Edit and Save a Record instantly
The end goal is to fire a validation rule without a user having to click Edit and then Save. The action is to "validate" that the record is ready to be submitted for approval. Since I cannot invoke a validation rule through the Submit for Approval button being pressed, I would like for the end users to be able to click a "Validate" button that will edit and save a record in order to check validation. If they invoke the rule, they know they are not ready to submit it and they receive the error message informing them of the fields they are missing. If they dont receive the message, they know they are ready to submit it for approval.
Thanks in Advance.
Thanks in Advance.
Hello, phiberoptik, I think you can do this using the AJAX Toolkit[1] and a custom button configured for "Execute JavaScript". For a button (like this sample Account button[2]) to work, I think you need to add a checkbox field that will set off the validation rule. This checkbox field doesn't have to be displayed to the user, so a user wouldn't even need to know it exists.
The general idea is:
It would be best to also set up a workflow rule that will automatically clear the validation checkbox every time it is set. This should be fine because workflow rules fire after validation rules in the order of execution[3].
[1]: AJAX Toolkit (http://www.salesforce.com/us/developer/docs/ajax/)
[2]: sample Account button (http://pastebin.com/wrm8Gevw)
[3]: order of execution (http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_triggers_order_of_execution.htm)