You need to sign in to do that
Don't have an account?
SFDCAdmin73
Approval Comments from a approval process not using a apex class & trigger?
Is there a way to update a custom field on a the opportunity record with the approval comments from the fina approver?
You can't copy approval comments from approval unless you use apex trigger. I've done that already for my org and I can help you with that if you want.
Beth
Please create field update to check copy comment field for final approval and final rejection action. This field would trigger approval comments to copy on opportunity. if you would like to copy existing approval comments then you can also use dataloader and mark this field to true.
Here is the opportunity Trigger code. Modify this code based upon your requirment.
I hope this would help.
if you want to write OR condition in if statement then you should use || and for AND condition you should use &&.
Not sure why. Here is the code I have for the trigger:
I used your code above and modified it for my requirements on my requirement for https://developer.salesforce.com/forums/ForumsMain?id=906F00000005K3P
The only issue is we have 2 approvers for one Matter__c record. when the first approver writes a comment , the comment does not go into the
Approver_Comment__c (long text ) field in the custom Matter__c object. When the second or last approver writes a comment, it goes into the Approver_Comment__c (long text ) field in the custom Matter__c object.
This there a way to modify the code below where when both approver writes a comment, it goes into the Approver_Comment__c (long text ) field in the custom Matter__c object?
trigger TriggerApprover on Matter__c (before update) {
if(trigger.isUpdate){
List<Matter__c> MatterList = [Select id,
(Select Id,
IsPending,
ProcessInstanceId,
TargetObjectId,
StepStatus,
OriginalActorId,
ActorId,
RemindersSent,
Comments,
IsDeleted,
CreatedDate,
CreatedById,
SystemModstamp
FROM ProcessSteps
ORDER BY CreatedDate DESC)
From Matter__c
WHERE Id IN : Trigger.new];
if(MatterList.size() > 0){
for(Matter__c mat : MatterList){
for(Matter__c mat1 : Trigger.new) {
//check copy comment is true
if(mat.id == mat1.id && mat1.Copy_Comment__c) {
if (mat.ProcessSteps.size() > 0) {
mat1.Approver_Comment__c = mat.ProcessSteps[0].Comments;
mat1.copy_comment__c = false;
}
}
}
}
}
}
}
When both approvers write a comment, I want all their comments from the Approval process to be combined ( concatenate seperated by a comma, ) into the Approver_Comment__c (long text ) field in the custom Matter__c object.
Thanks