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

Catalog client script

shaikkhasim
Tera Contributor

Hi Team

i  created a catalog item (Device req) & created Requested for filed as (username).

hear my requirement is, once i selected the username . email id will fill automatically in Email field.(email back end value is "email")

pls guide me how to achieve these through catalog client script 

 

Thanks in advance 🧡🧡

Regards

khasim. 

 

khasim
1 ACCEPTED SOLUTION

Use this

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }
    var ref = g_form.getReference('user_name', req_for);
    }
function req_for(ref) {
       
        g_form.setValue('email', ref.email);
    }
}
-Anurag

View solution in original post

8 REPLIES 8

Hi Anurag bhai

Based on  your code, i have  created my own code but it is not working, pls guide me 

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }
var mangager1=g_form.getReference('user_name');
var t=manager1.manager;
g_form.setValue("email",t);
   //Type appropriate comment here, and begin script below
   }
Regards
khasim
khasim

Hi Khasim,

This is not what I gave, what are the name of the two variables?

The one that has user and the one you want to populate email?

-Anurag

Hi Bhai

pls find the attachment,  my two variables are user(Requested for) and email

 

Regards

Khasim

khasim

Use this

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }
    var ref = g_form.getReference('user_name', req_for);
    }
function req_for(ref) {
       
        g_form.setValue('email', ref.email);
    }
}
-Anurag