We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

how to get value of assignment group

kabi
Tera Contributor

I created this client scripts on the incident table.

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

var abc=g_form.getValue('assignment_group');
      alert(abc.Name);
   
}

Everytime we changes the value in assignment group I want to show that value in alert. Right now its showing the sys_id value.

Please help

1 ACCEPTED SOLUTION

User179407
Mega Guru

try this




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


  if (isLoading || newValue === '') {


  return;



  }


  var abc = g_form.getDisplayBox('assignment_group').value


  alert(abc);


}


View solution in original post

9 REPLIES 9

Thank you, It worked for me..

samiul1
Tera Expert

Hi Kulbir,



Since you are using "getValue", it should display the sys_id.


Instead, use "getReference('assignment_group')"


kabi
Tera Contributor

I tried the getreference and its giving the sys_id value as well


It should return the 'sys_id', because it's a referenced field.



Afterwards, use nullreturned's below written code to get your value. That is:




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


if (isLoading || newValue === '') {


return;
    }



    var abc = g_form.getReference('assignment_group', alertName);  


}



function alertName(abc) {


  alert(abc.name);


}


nullreturned
Kilo Guru

You'll also want to ensure it's running async, rather than sync.   So you'd do:



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


if (isLoading || newValue === '') {


return;
    }


     


    var abc = g_form.getReference('assignment_group', alertName);    


}



function alertName(abc) {


  alert(abc.name);


}