You need to sign in to do that
Don't have an account?
IS Admin 7
"We need to confirm that your request is valid. Please repeat your last action" error when using button executing Javascript for Approval Process submission
Can we replace the following code:
redirectPage = new PageReference(String.format('/p/process/Submit?retURL=%2F{0}&id={0}', new String[] {sObjId}));
with:
Approval.ProcessSubmitRequest approvalRequest = new Approval.ProcessSubmitRequest();
approvalRequest.setObjectId(sObjId);
Approval.ProcessResult approvalResult = Approval.process(approvalRequest);
if (!approvalResult.isSuccess())
{
ApexPages.Message error = new ApexPages.Message(ApexPages.Severity.ERROR, 'There was an error with the Submit For Approval Request.');
ApexPages.addMessage(error);
}
redirectPage =new PageReference(String.format('/{0}', new String[] {sObjId}));
redirectPage.setRedirect(true);
}
redirectPage = new PageReference(String.format('/p/process/Submit?retURL=%2F{0}&id={0}', new String[] {sObjId}));
with:
Approval.ProcessSubmitRequest approvalRequest = new Approval.ProcessSubmitRequest();
approvalRequest.setObjectId(sObjId);
Approval.ProcessResult approvalResult = Approval.process(approvalRequest);
if (!approvalResult.isSuccess())
{
ApexPages.Message error = new ApexPages.Message(ApexPages.Severity.ERROR, 'There was an error with the Submit For Approval Request.');
ApexPages.addMessage(error);
}
redirectPage =new PageReference(String.format('/{0}', new String[] {sObjId}));
redirectPage.setRedirect(true);
}
Salesforce has restriceted to send a record for approval in this way (Url passing).
This is an intentional change as part of Winter 16 release, to over come this you may need to use REST API to submit the approval or use apex code
https://help.salesforce.com/apex/HTViewSolution?id=000229821&language=en_US
http://salesforce.stackexchange.com/questions/94697/winter-16-problem-with-navigatetourl-p-process-submit
-Thanks
Ashlekh Gera