- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2020 12:51 AM
Hi All,
How to populate Request Company field in Requested item and catalog task. I have added run script core activity in workflow to populate request company field. So the same company is to populate in both requested item and catalog task.
Regards,
Sruthi
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2020 12:06 AM
Hi Sruthi,
please add these 2 lines in each catalog task activity advanced script section for whichever task you want it to be populated
var company = current.request.company;
task.<companyField> = company;
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
06-04-2020 01:19 AM
Hi Jaspal,
Company is not a catalog item Variable. It is a form field of the request, requested item and company.
Regards,
Sruthi

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2020 01:23 AM
Thanks Sruthi for the details. So, what should be the request company value set? Is it static or will be dynamic.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2020 01:44 AM
Hi Jaspal,
used run script core activity in workflow to populate company field. It's a static value.
Regards,
Sruthi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2020 02:25 AM
Hi Sruthi,
So if that would be static then is it getting populated as of now on Request record by default or you want that static value to be updated on Req, RITM and SC Task
If yes then you can use below script in run script activity to update all 3 table records with that field
Run Script:
var company = 'ABC';
//For Request
var requestRec = new GlideRecord('sc_request');
requestRec.get(current.request);
requestRec.<companyField> = company;
requestRec.update();
//For RITM
var ritm = new GlideRecord('sc_req_item');
ritm.get(current.sys_id);
ritm.<companyField> = company;
ritm.update();
Catalog Task Activity:
//For Task to be used in catalog task activity advanced script
var company = current.request.<companyField>;
task.<companyField> = company;
If my answer solved your issue, please mark my answer as ✅ Correct & 👍Helpful based on the Impact.
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
06-04-2020 03:36 AM
Hi Ankur,
I have already set Service Request company field value in Request using workflow.
var gr = new GlideRecord('sc_request');
gr.addQuery('sys_id',current.request);
gr.query();
while(gr.next())
{
gr.company='56ecf89cdbcf0c542f1c62d41b961937';
gr.update();
}
I want the same value to be populate in Requested item and Catalog task.
Do we can use business rule to achieve this?
Regards,
Sruthi