Auto Populate Catalog Item RITM and SCTask Form Fields

AP30
Tera Expert

Hello,

I am looking to auto populate the following fields with a default value in RITM and SCTask

u_category

u_subcategory

cmdb_ci

I used onChange client script but no difference. Below is my script. Please can you help with a better script to achieve this task? 

g_form.setValue('u_category', 'Alpha');
g_form.setValue('u_subcategory', 'Bravo');
g_form.setValue('cmdb_ci', 'Charlie');

Thank you.

1 ACCEPTED SOLUTION

AP30
Tera Expert

Finally used a Business Rule on sc_req_item and sc_task table and this worked fine.

View solution in original post

3 REPLIES 3

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Can you explain your question a bit more? Is this on Service Portal, on a Catalog Item for example? Can you also share your complete script. This is not all of it.

If it is just about a Catalog Item, and default value for the variables. Have a look at the variable itself, it contains a field Default value. Or are the value in the script you pasted just an example?
Do look carefully if the field type is string, or reference (in that case you need a sys_id), or select box (in that case you need the value, not the label).

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

This is for Catalog Item RITM and SCTask form fields. I am working on the script but that is all I have for now.

AP30
Tera Expert

Finally used a Business Rule on sc_req_item and sc_task table and this worked fine.