Business Rule - How to copy values from RITM to Task.

Meera_P
Tera Expert

Hello,

The blow business rule script currently trigger on RITM table and  successfully creates a new task. However, I'm struggling to bring the following reference fields from RITM to the newly created task.  Please help.  Thank you

 

Here are the values:

  •  gr.business_service = current.business_duration;
  •  gr.cmdb_ci = current.cmdb_ci;
  •  gr.assignment_group = current.assignment_group;

 

 

   var gr = new GlideRecord('sc_task');
        gr.initialize();
        gr.request_item = current.sys_id;
       
        gr.business_service = current.business_duration;
        gr.cmdb_ci = current.cmdb_ci;
        gr.assignment_group = current.assignment_group;
        gr.assigned_to = current.assigned_to;

        // Insert the new record and get the sys_id
        var newRecordSysId = gr.insert();

 

1 ACCEPTED SOLUTION

@Alka_Chaudhary 

Meera_P_0-1727995231084.png

 

Please disregard my previous thread. I switched to using Flow Designer instead of a Business Rule, and it's working perfectly now. Thank you!

View solution in original post

4 REPLIES 4

Alka_Chaudhary
Mega Sage
Mega Sage

Hello @Meera_P ,

 

The script isn't working because you're trying to assign a business duration value to the business service field.

To resolve this, you can either use gr.business_service = current.business_service; or gr.business_duration = current.duration;, depending on which field you intend to update.

 

If this solution helps you then, mark it as accepted solution ‌‌✔️ and give thumbs up 👍!

Thanks Alka,

 

@Alka_Chaudhary 

Thank you for pointing out my mistake. I realized it after posting my question. I removed all the values except for the assignment group to see if that would work, but it’s still failing.

 

var gr = new GlideRecord('sc_task');
        gr.initialize();
        gr.request_item = current.sys_id;
       
         gr.assignment_group = current.assignment_group;
      

        // Insert the new record and get the sys_id
        var newRecordSysId = gr.insert();

 

@Meera_P 

Could you explain what you included in the "When to" section when triggering the Business Rule?

@Alka_Chaudhary 

Meera_P_0-1727995231084.png

 

Please disregard my previous thread. I switched to using Flow Designer instead of a Business Rule, and it's working perfectly now. Thank you!