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
Prasanthi BPrasanthi B 

Error In Approval process

We have setup an approval process for opportunity. Whenever an opportunity is changed to the back stage, it should go for manager's approval. In normal scenario, it is working fine.But the problem is that if the record is rejected for the first time, next time the same record is sent for approval. Then the manager is not able to approve the request. An error message is displayed as below. In the trigger, we are making the Stage field set back to the old value only as below.


         a[i].StageName = b[i].StageName;


Please suggest why this field is getting null value?


Validation Errors While Saving Record(s)
There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Required fields are missing: [Stage]".





In your code, from where the "b[i]" is coming? it looks like that the value in b[i] array for stage is blank and thats why the validation error occurred. Please make sure that b[i].stageName must have the value before assigning it to a[i].stageName.