You need to sign in to do that
Don't have an account?
KCL
Approval comments
I have a custom object to store Comments(mattercomments__c)
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?
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?
List<Matter__c> matList = [Select id, Approver_Comments__c, (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(matList.size() > 0){ List<mattercomments__c > notes_new = new List<mattercomments__c >(); for(Matter__c mat : matList){ for(Matter__c mat1 : newlist) { //check copy comment is true if(mat.id == mat1.id) { if (mat.ProcessSteps.size() > 0) { mat1.Approver_Comments__c = mat.ProcessSteps[0].Comments; } } if(mat1.Approver_Comments__c != mat.Approver_Comments__c && !mat.ProcessSteps.isEmpty() && (mat.ProcessSteps[0].StepStatus == 'Approved' || mat.ProcessSteps[0].StepStatus == 'Rejected')){ notes_new.add(new mattercomments__c (Matterr__c__c= mat.id, Steps__c =mat.ProcessSteps[0].Comments, Type__c = mat.ProcessSteps[0].StepStatus+' Comments')); } } } if(!notes_new.isEmpty()) { insert notes_new; } }
List<Matter__c> matList = [Select id, Approver_Comments__c, ...... where ID in :Trigger.new FOR UPDATE];