Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

on load client script

AnjaliY27945328
Tera Contributor

hello every  I struck while onload client script

Anjaliyadav1_0-1714483603421.png

I'm getting the desired result with this script

desire result should be

 

Anjaliyadav1_1-1714483769001.png

 

pls help me....

 

2 REPLIES 2

sujitha16
Kilo Patron

@AnjaliY27945328 Please use the below script to populate the values,

 

If caller is auto-populated then onLoad client script.

 

 

function onLoad() {
   //Type appropriate comment here, and begin script below   
    var caller = g_form.getReference('caller_id', setLocation);

function setLocation(caller) {
    if (caller)
    g_form.setValue('location', caller.location);
    g_form.setValue('department', caller.department); 
        //Add your necessary fields to set the value
}
}

 

If caller is changed then its onChange client script,

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

    var caller = g_form.getReference('caller_id', setLocation);
}

function setLocation(caller) {
    if (caller)
        g_form.setValue('location', caller.location);
        g_form.setValue('department', caller.department);		
}

 

Result : 

SujathaVM_1-1714579775561.png

 

 

Please mark this as helpful and accept it as a solution if this resolves your query.

Thanks,

Sujatha V.M.

 

 

Please mark this as helpful and accept it as a solution if this resolves your query.
Sujatha V.M.

Not applicable

Hi @AnjaliY27945328 ,

Can you please try this script 

 

g_form.setValue('u_caller', g_user.userId)
var userref = g_form.getReference('u_caller', userLookup);
	  function userLookup(userref){
	    g_form.setValue('location', userref.location.toString());
	    g_form.setValue('location', userref.email);
	    g_form.setValue('location', userref.department);
	    g_form.setValue('location', userref.location.toString());
	  }

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards 

Sarthak