How to copy Region field from incident to REQ & RITM & SC Task.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi,
If a request created from an Incident how i can copy region field to REQ & then RITM & then SC Task?
Thanks in advance.
Regards,
Juganta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
If I would be you, I would only create one more additional region field on RITM or SCTASK form. It would not make sense to create same field for every form. I would create an after Business Rule on Incident table. Business rule should run on Insert. Try below code on BR
// Example code to copy region field from Incident to SCTASK
(function executeRule(current, previous /*null when async*/) {
var task = new GlideRecord('sc_task');
task.addQuery('parent', current.sys_id);
task.query();
while (task.next()) {
task.region = current.region;
task.update();
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @AlpUtkuM ,
Thanks for your email.
Above BR is not working.
Any other solution do you have?
Regard,
Juganta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Did you pay attention to the exact field names? Alternatively, you could try using flow designer to replicate the field value from Incident to the form you want.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
When you order from the catalog via that ui action, the originating incident will be added as a parent to the request [sc_request] record. Consider if you really do need to duplicate the same data in multiple places when you have a clear hierarchy from the sc_task to the incident where the information is stored.
If you really can't live without it then you can just put something like this in a before br on sc_req_item and sc_task
//ritm/sctask
current.setValue("u_region, " current.request.parent.u_region.getValue());
//req
current.setValue("u_region, " current.parent.u_region.getValue());
