function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Dianna Raquel Perez GüerequeDianna Raquel Perez Güereque 

Validation rule on approve?

Hello there!:

Is there a way to have a validation rule on an approve?...
I mean... I have a register created from a VF. This register will be sent to approve automatically... But i don't want the approver to approve this before he/she fills some fields.
In other words, i need this register sent to approve to make the approver notice that has a new register to validate. But i want the approver to fill some fields that only the approver will know. As a validation, i don't want the approver to approve if he/she doesn't fill those fields. Like an alert or something... "you can't approve this register if you haven't fill the required fields X, Y and Z" 

I thought on change the register type from the VF, send to approve but hide the approve section on the page format, then make this fields mandatory and when saved with the changes, return to another register type with the approve section visible...
But thought it could be a easier way to do this with validation rules or a functionality i don't know yet. 

Any thoughts? 
Beer NutthawanBeer Nutthawan
Hi Dianna

Here is my idea: 
1. User A registers and submits the form for approval
2. Approver gets notify email for approval
3.Approver checks the VF page and input some fields(X, Y and Z) and approves **This Approval Section is invisible to User A. 
4.Email notify will be send to User A after approval.
5. User A sees the VF page that it has been approved (may be just status) but this person can't see X,Y,Z field

** In order to visible the Approval Section from VF page, you can use: 
<apex:relatedList list="ProcessSteps" render="{!isApproverSignedIn}"></apex:relatedList>
Where "{!isApproverSignedIn}" is the Boolean to check whether the person who opens this VF page is the Approver or not. If not then set it to "false" then this Approval Section will be hidden, if "Yes" which is the Approver sees the Page then the Approval Section will be visible. 

If you can use just visualforce standard page you can use Field security setting insead. 

Hope this help.

Nutthawan.Beer