- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2024 02:19 PM
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();
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2024 03:42 PM
Please disregard my previous thread. I switched to using Flow Designer instead of a Business Rule, and it's working perfectly now. Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2024 02:53 PM
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,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2024 03:17 PM
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();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2024 03:34 PM
Could you explain what you included in the "When to" section when triggering the Business Rule?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2024 03:42 PM
Please disregard my previous thread. I switched to using Flow Designer instead of a Business Rule, and it's working perfectly now. Thank you!