The CreatorCon Call for Content is officially open! Get started here.

How to populate Request Company field in Requested item and catalog task.

sruthig
Tera Expert

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

 

1 ACCEPTED SOLUTION

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;

find_real_file.png

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

18 REPLIES 18

Hi Sruthi,

you can use the same run script activity to update for RITM

For making it populate on Catalog Task you can use the advanced script section when you use the catalog task activity in workflow

Ensure you give valid field name of company present on RITM and SC Task table

//For RITM

var ritm = new GlideRecord('sc_req_item');

ritm.get(current.sys_id);

ritm.<companyField> = ritm.request.company;

ritm.update();

Catalog Task

//For Task to be used in catalog task activity advanced script

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

Thanks Ankur!

It's working now for RITM Company field.

But I have used Switch activity in some of the workflow. In that Requested item company is populating same as request. But task company field is not populating. 

For below task company is not populating

find_real_file.png

 

Regards,

Sruthi

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;

find_real_file.png

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@sruthig 

Let me know if that answered your question.

If so, please mark my response as correct & 👍 helpful so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.

Regards
Ankur

 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@sruthig 

Hope you are doing good.

Let me know if that answered your question.

If so, please mark my response as correct & 👍 helpful so that this thread can be closed and others can be benefited by this.

Regards
Ankur

 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader