Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

How to push Record producer name into a custom field on the form created by the very Record producer.

ravikiran0688
Tera Contributor

When a case is created using a record producer, we want the name of the producer to be updated in one of the custom field on the case form.

@Ankur Bawiskar @Allen Andreas @Sandeep Dutta 

1 ACCEPTED SOLUTION

Hi,

you mentioned your custom field is reference to sc_cat_item_producer table

So you just had to use this and use correct field name

cat_item.sys_id -> gives sysId

current.u_customField = cat_item.sys_id;

Regards
Ankur

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

View solution in original post

16 REPLIES 16

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you can use this in record producer script

current.u_customField = cat_item.name;

OR

if that doesn't work then use this

var gr = new GlideRecord("sc_cat_item_producer");
gr.addQuery("sys_id", cat_item.sys_id);
gr.query();
if (gr.next()) {
	current.u_customField = gr.name;
}

Regards
Ankur

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

Hi @Ankur Bawiskar,

 

Both of the codes didnt work, May be i should have mentioned that this custom field is a reference field and is referring to "sc_cat_item_producer_list" table.

then just do this

current.u_customField = cat_item.sys_id;

Regards
Ankur

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

Hi Ankur,

We are avoiding using sys id in scripting.

Rgeards,

Ravikiran