Get information from one variable set to another

asd22
Tera Contributor

Hello.

 

Im making a catalog item, that is gonna be used to look up users in a reference field. Then when you select a user his/hers information will auto populate the fields in the catalog item.

Variable set A, that's where the user basic information gets collected, Here i select the name and the users ID, status gets auto inserted into fields.

 

Then i have Variable set B. Here i have "account expire date", where i want the users account expire date to be auto filled in. The only issue, i need to get variable set B to notice when variable set A gets changed, how do i do this?

 

This are my current catalog client scripts:
Variable set A 

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }
    var userref = g_form.getReference('varA_name', userLookup);
    function userLookup(userref) {
        g_form.setValue('varA_employeid', userref.user_name);
    }  
}





 

Variable set B

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }
    var userref = g_form.getValue('varA_name', userLookup);
    function userLookup(userref) {
        g_form.setValue('varB_accountexp, userref.account_expires);



    }  
}

 

1 ACCEPTED SOLUTION

Please check the backend field name of your field 'account expires' from reference table configuration.

I believe it is u_account_expired.

 

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

View solution in original post

14 REPLIES 14

Glad to help,

Please mark appropriate answer/s (one or more) as correct and helpful so that others can take benefit.

 

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

asd22
Tera Contributor

I took and made a catalog client script in the main form im making. And i added the first script you posted.

asd22_0-1700650403933.png

 

it changed nothing. Then i testen if Variable set A script was messing it up so i made variable set A script not active, but the main form script did still not work.

Hi,

You have not selected variable name in your script configuration.

Variable name field on script is empty (just below red colour mark )

 

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

asd22
Tera Contributor

Do i also need to move my variable set A and B scripts om the variable set clien script to the main form client script?

Hi,

You don't need scripts in variable sets (because client script in SetB will not work if SetA is not added)

Only one client script is required on Main form.

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande