+ Start a Discussion
sam_Adminsam_Admin 

Is it possible to override approval process (approve/reject) with the Visual force page

I want to create visualforce template to approve/reject record when a record is submitted for approval. Approval manager travels and he wants an external link to approve rather than going into salesforce so i created text template and used {!ApprovalRequest.External_URL} but this merge field doesn't works and confirmed that it's salesforce bug so is it possible to create an visualforce template with comments box and approve/reject button?
Best Answer chosen by sam_Admin
Varun PareekVarun Pareek
Okay, I didnt know you were using a multi-step approval process. Looks like it doesnt work with that. 
Before enabling email approval response, note that you cannot use this feature with approval processes in which the assigned approver is a queue, or in a multi-step approval process in which the next approver is manually chosen after the first step. Also, users that use Microsoft® Word® as their email editor must add the comments to the end of the first line of the reply email instead of the second.

One potential solution can be - Not enable the approval response, rather have your own email template with the required information. Write an inbound email handler such that once the approver replies to approve/reject the record, you set the reply-to the inbound handler and parse the response and capture it in comments. This would not require a VF page. Refer this to approve/reject record via apex:
https://developer.salesforce.com/forums/ForumsMain?id=906F00000008z9LIAQ

All Answers

Varun PareekVarun Pareek
Sam - Salesforce does provide the ability to Approve/Reject record via email. Its an OOTB feature that you can leverage. You may not need a VF page in that case. Please refer:
https://help.salesforce.com/HTViewHelpDoc?id=approvals_email.htm&language=en_US
sam_Adminsam_Admin
Varun, Thats true but the comments doesn't shows up in the email that's the reason i need to create template to able to approve via external url and show the comments as well. 
Varun PareekVarun Pareek
Not sure how exactly the approver is approving the record, but this is what needs to be followed. Comments should be in second line. I had got this to work in one of my previous assignments. You may be missing something.

For salesforce.com to process your response the word APPROVE, APPROVED, YES, REJECT, REJECTED, or NO must be in the very first line of the reply email. Also, any comment must be in the second line.
 
sam_Adminsam_Admin
You are right you can add the comments and you can also approve/reject it with key words but when we have 2 levels of approval request when first level approver approve/reject record and add comments in second line via email then the second level approver doesn't gets the comments he only gets an email to approve or reject and in order to see the comments he needs to login to salesforce and we don't have way to modify the template to include comments merge field.makes sense?
Varun PareekVarun Pareek
Okay, I didnt know you were using a multi-step approval process. Looks like it doesnt work with that. 
Before enabling email approval response, note that you cannot use this feature with approval processes in which the assigned approver is a queue, or in a multi-step approval process in which the next approver is manually chosen after the first step. Also, users that use Microsoft® Word® as their email editor must add the comments to the end of the first line of the reply email instead of the second.

One potential solution can be - Not enable the approval response, rather have your own email template with the required information. Write an inbound email handler such that once the approver replies to approve/reject the record, you set the reply-to the inbound handler and parse the response and capture it in comments. This would not require a VF page. Refer this to approve/reject record via apex:
https://developer.salesforce.com/forums/ForumsMain?id=906F00000008z9LIAQ
This was selected as the best answer
sam_Adminsam_Admin
Thanks Varun. I will dig into this but this should be helpful.Appreciate your reply 
Varun PareekVarun Pareek
Sure. We implemented a custom approval process using custom objects in similar way. Worked like charm.

P.S - Please mark the question as answered which may help others.
sam_Adminsam_Admin
Iam trying to implement even for custom object. Was it same as 2 level approvals? If so could you please share your code?
Varun PareekVarun Pareek
Unfortunately I cannot share the client specfic code. But here is what the requirement looked like:
We had a custom object on which we had to build the approval process such that we had to enable parallel approval. Catch was even if one of the approvers rejected it, the record may or may not be rejected. It was like if there are total of 10 approvers, we would need at least 7 to approve it. So even if the other 3 rejects, the record is still approved. We used a lot of apex for this and of course the inbound email handler. It may sound a lot of work, but a developer with good apex skills would be able ti pull it off quite easily since the "process" is pretty straight forward.
sam_Adminsam_Admin
Got it and yes sounds more complex. I will look into those links. Thanks again