Setting One Field Based on Another

soljahx
Kilo Explorer

Good day,

I'm trying to set 2 separate fields based on the setting of a third. More specifically, I have created a reference field (called 'Problem Item') on the ESS View of the Incident form which references the cmdb_ci table - the intent being to allow the customer to simply type the item he / she is having a problem with and have the field populate. On the ITIL worker side, I need to set 2 other fields called Category & subcategory on what is selected in the Problem Item field on the ESS Incident form.

What would be the best method to accomplish this?

I'm new to Service-now and have tried UI policies, client scripts, and business rules but have not been able to make it work - but I suspect this is most likely because of my unfamiliarity with how these work and my weak Javascript skills.

Any suggestions would be greatly appreciated. Thanks.

4 REPLIES 4

DrewW
Mega Sage

Have you tried a Client side on change script something like

function onChange(control, oldValue, newValue, loading) {
if (loading)
return;
g_form.setValue('category', g_form.getValue('ci_Selected.category'));
}

Then set a category for each CI. You have to make sure that the chouse list values match or it has issues.


I've had some trouble getting the client scripts to work - mainly because I'm still learning the proper syntax, but I'll give this a try. Thanks for replying.


You may want to look this wiki item over
http://wiki.service-now.com/index.php?title=Client_Scripts

Specificly the "Look up the value of a reference field " section.


By the way this works great

function onChange(control, oldValue, newValue, isLoading) {

if (isLoading)
return;

var caller = g_form.getReference('caller_id');
g_form.setValue('u_phone', caller.phone);

}