copy work notes to work order from workorder task

Research
Tera Guru

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

AshishKM
Kilo Patron
Kilo Patron

Hi @Research 

You can write business rule [update]  on table ( wm_task ) with "When to run" condition for Work notes changes.

and write the below code in "Advaced" tab for copying the work notes from wm_task to associated wm_order record.

 

 

 

current.wm_order.work_notes = current.work_notes;

 

 

AshishKMishra_0-1698855959597.png

 


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

Research
Tera Guru

Hi @AshishKM 

Can you check below code 
any changes required. please suggest

Research_0-1698909123551.png

 


Thanks.

 

 

Please test this BR and share the result or any further issue. 

 


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

Research
Tera Guru

Hi  @AshishKM BR is not working as expected and not starting.

Could you please help on it.

Thanks.