- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2019 08:28 AM
The Company field is not inheriting/auto-populating in the SCTASK record even though the field is present in the RITM.
User raises the request and RITM gets created in which the company will get added automatically based on the user.
I have added the same Company field to the task which got created from the RITM. But the value is not getting captured automatically in the 'Company' in SCTASK.
RITM:
SCTASK:
Solved! Go to Solution.
- Labels:
-
Request Management
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-01-2019 12:51 AM
Hi Amith,
the field is newly created on sc_task or sc_req_item table?
if yes on RITM and if it is populated on RITM level during catalog item submission then it should be visible on task form if you are adding it from dot walk
if above field is newly created on sc_task then you need to set it via script
have before insert business rule on sc_task and have following script
var item = new GlideRecord('sc_req_item');
item.addQuery('sys_id', current.request_item);
item.query();
if(item.next())
current.company = current.request_item.company;
// pick the company to be populated on sc_task from sc_req_item
// current.item is not valid since sc_task doesn't have that field
}
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
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
‎07-01-2019 12:47 AM
(function executeRule(current, previous /*null when async*/) {
var item = new GlideRecord('sc_req_item');
item.addQuery('sys_id', current.request_item);
item.query();
if(item.next())
current.company = item.company;
}
)(current, previous);
Try this.
Just put the BR on Update so that you dont need to write current.update()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-01-2019 06:42 AM
Thanks Omkar. Its working perfectly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-01-2019 12:51 AM
Hi Amith,
the field is newly created on sc_task or sc_req_item table?
if yes on RITM and if it is populated on RITM level during catalog item submission then it should be visible on task form if you are adding it from dot walk
if above field is newly created on sc_task then you need to set it via script
have before insert business rule on sc_task and have following script
var item = new GlideRecord('sc_req_item');
item.addQuery('sys_id', current.request_item);
item.query();
if(item.next())
current.company = current.request_item.company;
// pick the company to be populated on sc_task from sc_req_item
// current.item is not valid since sc_task doesn't have that field
}
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
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
‎07-01-2019 06:42 AM
Thanks Ankur. Its working perfectly.