Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

copy work notes to work order from workorder task

Not applicable

Hi All

I want to copy worknotes of workorder task (wm_task) to workorder worknotes  (wm_order).

 

 

Please can guide and suggest me the script please 

Thanks.

1 ACCEPTED SOLUTION

Please add logs and check if process trigging.

Also add the current.update(); for [ testing only ], If its working means we need to update work_order record differently  because current [ object ] belong to wm_task not the wm_order.

 

Use the below code in the BR and share the result.

 

var grWmOrder = New GlideRecord("wm_order");
      grWmOrder.addQuery("sys_id",current.wm_order); // wm_order is reference field on wm_task
      grWmOrder.query();
  if(grWmOrder.next()){
          grWmOrder.work_notes = current.work_notes; // update the work note from task to order
          grWmOrder.update();

    }

 

 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

View solution in original post

7 REPLIES 7

Please add logs and check if process trigging.

Also add the current.update(); for [ testing only ], If its working means we need to update work_order record differently  because current [ object ] belong to wm_task not the wm_order.

 

Use the below code in the BR and share the result.

 

var grWmOrder = New GlideRecord("wm_order");
      grWmOrder.addQuery("sys_id",current.wm_order); // wm_order is reference field on wm_task
      grWmOrder.query();
  if(grWmOrder.next()){
          grWmOrder.work_notes = current.work_notes; // update the work note from task to order
          grWmOrder.update();

    }

 

 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

Good to see that your issue resolved, happy to help. 😊

 

 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

Not applicable

Yes @AshishKM Appreciate for your help
Its helped my requirement
Thankyou.