Guest User

Untitled

a guest
Jan 21st, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. List<Work_Order__c> woList = [Select id,
  2. (Select Id,
  3. IsPending,
  4. ProcessInstanceId,
  5. TargetObjectId,
  6. StepStatus,
  7. OriginalActorId,
  8. ActorId,
  9. RemindersSent,
  10. Comments,
  11. IsDeleted,
  12. CreatedDate,
  13. CreatedById,
  14.  
  15. SystemModstamp
  16. FROM ProcessSteps
  17. ORDER BY CreatedDate DESC)
  18. From Work_Order__c
  19. WHERE Id IN : Trigger.new];
  20.  
  21. if(woList.size() > 0){
  22. for(Work_Order__c wo : woList){
  23. for(Work_Order__c wo1 : Trigger.new) {
  24.  
  25. if(wo.id == wo1.id && wo1.copy_comment__c ) {
  26. if (wo.ProcessSteps.size() > 0) {
  27.  
  28. wo1.Approver_Comment__c = wo.ProcessSteps[0].Comments;
  29. wo1.copy_comment__c = false;
  30. }
  31.  
  32. }
  33.  
  34. }
  35. }
  36. }
  37.  
  38. }
  39.  
  40. if(woList.size() > 0){
  41. if (wo.ProcessSteps.size() > 0) {
  42.  
  43. wo.Approver_Comment__c = wo.ProcessSteps[0].Comments;
  44. wo.copy_comment__c = false;
  45. }}}}
Add Comment
Please, Sign In to add comment