auto populate values based on another field value

Dinesh Kumar C
Tera Contributor

I have a field which is referenced to "sys_user" table . If i select a value from user table then value of some other fields populate automatically . Below are the fields

find_real_file.png

Do i need to Business rule or client script to archive this ? How

1 ACCEPTED SOLUTION

Harsh Vardhan
Giga Patron

Hi Dinesh,



Please try with script below.



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


    var caller = g_form.getReference('caller_id', doAlert); // doAlert is our callback function


}


function doAlert(caller) { //reference is passed into callback as first arguments


  g_form.setValue('email',caller.email);


  g_form.setValue('phone',caller.mobile_phone);


  g_form.setValue('phone',caller.location);


}



Please change the variable name that you have exactly on your catalog form.


View solution in original post

10 REPLIES 10

Above script is working.. Thank you!

Harsh Vardhan
Giga Patron

Hi Dinesh,



please check with below updated script i tested and it's working.



find_real_file.png


Hi Harshvardhan , Thanks mate , its working . Cheers Regards, Dinesh


Hi Harsh,

 

When I try this, i just get the sys ID 3beaa790dbf9649045c73ce3399619c5 instead of the value 😞

what am I missing?

my problem statement is - 

update mailbox owner (we have 4 different mailboxes )

(Based on a choice for these mailboxes, i display the selected mailbox)

The user should be allowed to select any active mailbox from any mailbox collection.

The previous user should be should on the screen when a mailbox is selected ("Current Owner" field, protected).

I think i found the answer by changing the variable type to reference from single text and mapping it with the table you want the value of. In my case it was user table.