- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2021 09:27 AM
Hi All
I have a requirement that says whenever the "Service Type" field on the service offering table(child table) is inserted or updated.
on the parent table called "Business Service " the "Service Type" field should be updated with the same as the child table's "service type" value
Can someone provide me a solution..???
Thanks
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2021 04:01 AM
Dot walk and update doesn't work, you have to GlideRecord to parent record and update it.
(function executeRule(current, previous /*null when async*/ ) {
var servicetype = current.getValue('u_service_type');
if (JSUtil.notNil(current.parent)){
var gr = new GlideREcord('<parent table>');/add the table name here
gr.addQuery('sys_id',current.parent )
gr.query();
if(gr.next())
{
gr.u_service_type = servicetype;
gr.update();
}
})(current, previous);
The condition of the BR should be that current.parent is not empty AND current.u_service_type Changes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2021 02:48 AM
Hi,
you can easily achieve this using flow designer with no script.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2021 08:52 AM
I am new to flow designer I haven't tried it so far. but I have heard that it reduces the effort of scripting.
Thanks for the suggestion