variable value is "undefined"

alexm3
Kilo Expert

Hello,

I have a variable on a record producer named "dsn_name". At the moment, the type of the variable is wide single line text.

I also have another variable named caller_id which is a reference to sys_user table and it's mapped on the caller field. By default this value is populated with the ID of the person currently logged in the instance.

I'm trying to pull a value from the'caller_id"(distinguished_name) and populate it in the "dsn_name" field. My catalog client script looks like this:

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

var poc = g_form.getReference('caller_id');

g_form.setValue("dsn_name", poc.distinguished_name);

  }

I'm getting 'undefined' instead of showing the distinguished_name value.

Capture.JPG

Any ideas would be me appreciated !

Thanks

Alex

14 REPLIES 14

Kushagra Mehrot
Kilo Guru

what type of field is the distinguished_name ?


using poc.sys_id will copy the name of the requester because the getreference is 'caller_id'.



distinguished_name type is string. it's stored on each user profile.



Alex


It worked fine for me just try putting some alerts.


What is the field name on which you have written this change client script, it should be called_id



Also Try This: just make sure for the is loading and newvalue parameters



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


      if (isLoading){


              if(!newValue == '') {


            var poc = g_form.getReference('caller_id');



g_form.setValue('dsn_name',poc.distinguished_name);


              }}



    //Type appropriate comment here, and begin script below


   


}


The field name is caller_id



tried your solution, still not working. The value I'm getting is " undefined" as shown in the picture above.



I don't understand what I'm doing wrong. The script looks correct but it's not pulling the value