Show department according to user name

Balbir_Singh
Tera Expert

Hi All!
i have a requirement. i want to show the department according to the user.

i am using the below code:

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

//Type appropriate comment here, and begin script below
var c=g_form.getReference('assigned_to',val2);
function val2(data){
g_form.setValue('department',data.parent);
}

}

1 ACCEPTED SOLUTION

DEV976
Tera Expert

Hi @Balbir_Singh, try this callback function.

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

//Type appropriate comment here, and begin script below
var data=g_form.getReference('assigned_to',val2);
function val2(data){
g_form.setValue('variable_name',data.department); // write variable's name here
}

}

View solution in original post

2 REPLIES 2

Karthiga S
Kilo Sage

Hi @Balbir_Singh 

 

Please try the below syntax and then use SetValue.

var assignedToDepartment = g_form.getReference('caller_id').department;
alert(assignedToDepartment);

 

 Please mark it Correct and Hit Like if you find this helpful!

Regards,

Karthiga

DEV976
Tera Expert

Hi @Balbir_Singh, try this callback function.

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

//Type appropriate comment here, and begin script below
var data=g_form.getReference('assigned_to',val2);
function val2(data){
g_form.setValue('variable_name',data.department); // write variable's name here
}

}