Set a variable with default value based on another variable

bijender1
Tera Contributor

Hi,

We need to set up one variable with different values based on another variable on the joiner form.

Variable "Team"  type select box . if select box is IT.  then another variable "shareddrive" of type " multi line text" will show default value as " this is the default drive IT team needs access"

and if 

select box in Team variable is HR, then the same another variable " shareddrive" of type " multi line text" will show default value as " this is the default drive HR Team needs access"

Regards,
B

 

7 REPLIES 7

Hi,

 

Add advanced refence qualifier with 'Assess to Shared Department Folder ' variable 

Add code like -New 'Script Include Name'().function_Name(Team value);

Team value is variable 'Team' value.

You have to write script include and return value based on Team value.

for more refer below link.

https://community.servicenow.com/community?id=community_question&sys_id=43918769db98dbc01dcaf3231f96...

Mark this answer as Correct and Helpful

Thanks,

Manjusha Bangale

 

Hi,

Go with below link .

https://community.servicenow.com/community?id=community_question&sys_id=43918769db98dbc01dcaf3231f96190d

dont use reference qualifier instead use on change client script on variable 'Team' to call script include.

Thanks,

Manjusha Bangale

Omkar Mone
Mega Sage

Hi 

Can you try this :-

 

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

if (g_form.getValue('u_team')=='it') {
g_form.setValue('ATSDept',"this is the default drive IT team needs access");


}

}