auto populate values (single line text) based on another field value (type reference)

santiago_bergal
Tera Expert

Hello, I have a variable (type reference) which is called territory. Based on the selection of a given territory, another field (CISO group) should be autopopulated. I was working on the client script below but it hasn't worked so far. Any clues? suggestions?


function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}

var territory = g_form.getReference('territory', callback); 

 

function callback(territory) { //reference is passed into callback as first arguments


g_form.setValue('ciso_group',territory.sys_user_group);


}

1 ACCEPTED SOLUTION

g_form.setValue('ciso_group',territory.u_ciso_group); 

Did this not work? What type of variable is  ciso_group? is it a reference variable or single line test?

also try to do  alert(territory.u_ciso_group); in your function to check what are you getting.

View solution in original post

8 REPLIES 8

g_form.setValue('ciso_group',territory.u_ciso_group); 

Did this not work? What type of variable is  ciso_group? is it a reference variable or single line test?

also try to do  alert(territory.u_ciso_group); in your function to check what are you getting.

Thank you, RaghavSh!

 

It looks like it is working (see image below). The ciso group is displayed in the RITM I created to test. I guess I was expeting to see it autopopulate in the form while I was creating it. Any clues as to how to do that? I'll give the alert a try to make it more visual.

Thank you! 🙂

 

santiago_bergal_0-1670503701806.png

 

 

Dismiss my previous comment, it's working just fine in the form itself. I'll give it a couple of tweaks so as not to get the sys_id.

 

THANK YOU!!

 

santiago_bergal_1-1670503940340.png

 

Sure, if this is resolved, you can mark the relevant answer correct to close the thread.