- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2017 05:09 AM
I have this impacted services related list in my incident form.
I want the "managed by" field which is a reference field of user table to be populated to a custom field in my INC form. Kindly help me to
achieve this. Developer Community bawiskar
Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2017 05:25 AM
Not sure how you are going to pull that off but here is code for adding users to a list field that relates to the sys_user table. Adding or removing an Affected CI in the related list will trigger an update of the List field and add assigned to from all the related CI's to the u_service_owner field.
List field on Incident table called u_service_owner referencing sys_user table.
Business rule on task_ci table. Runs after on Insert, Update and Delete.
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var inc = new GlideRecord('incident');
inc.addQuery('sys_id',current.task);
inc.query();
if(inc.next()){
inc.u_service_owner=''; //Clear service owner list
var ci = new GlideRecord('task_ci');
ci.addQuery('task',current.task);
ci.query();
while (ci.next()){
inc.u_service_owner += ',' + ci.ci_item.assigned_to; //Add CI assigned to
}
inc.update();
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2017 05:23 AM
Hi,
Since Impacted Services is a related list, it will be possible to have multiple records connected to the Incident. How can you tell which record should update the Incident with Managed by?
Regards,
Niklas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2017 06:34 AM
Hi Niklas,
Along with this i have affected CI related list which has a owned by field that should be also populated in the custom field of INC form. Kindly help me with this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2017 06:40 AM
It can be done with a Business Rule but you still need to define which record from the related list should update the Incident Record. A field on the Incident record will only be able to contain information from one other record.
/Niklas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2017 06:49 AM
Hi Niklas,
can u plz tell me d BR script which will update for one record only..
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2017 07:25 AM
Niklas i guess we cant populate the field value in a form using BR...