Dot walking script help

cpinedatx94
Tera Expert

I need help writing a script with dot walking. I have a reference field on my form (Candidate) and i want my script to pull a field from that record (clearance type) and then set the value of a field on my current form to that. With the help of ChatGPT ive come up with this, but it appears to not be working. Can someone help me out please.

 

 

 

 

function onLoad() {
   //Type appropriate comment here, and begin script below
   var clearanceType = g_form.getReference('u_candidate').clearance;
alert(clearanceType);
g_form.setValue('u_req_clearance',clearanceType)
}

 

 

7 REPLIES 7

Sandeep Rajput
Tera Patron
Tera Patron

@cpinedatx94 Please try the following.

 

function onLoad() {
    //Type appropriate comment here, and begin script below
    var clearanceType = g_form.getReference('u_candidate', getClearance);

    function getClearance(clearanceType) {
        g_form.setValue('u_req_clearance', clearanceType.clearance);
    }
}

In case if the above script doesn't work then please share the technical names of your fields and a snapshot of the form if possible.

Still not working,

The reference field is "u_canadidate" which refers to the "Local technician table" I need it to pull the "Clearance" field value from the record and then set the value of "u_req_clearance" on the current form to the same as it 

AshishKM
Kilo Patron
Kilo Patron

Hi @cpinedatx94 ,

Just check if Clearance Type variable name is "clearance" and alert is displaying the same. 

function onLoad() {
   //Type appropriate comment here, and begin script below
   var clearanceType = g_form.getReference('u_candidate').clearance;
         alert(clearanceType);
         g_form.setValue('u_req_clearance',clearanceType);  //added semi colon in last
}

-Thanks,
AshishKMishra


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

Its actually "Clearance" with a uppercase C. When i use that in the script the word "Clearance" turns blue. Which leads me to believe something is going on there. i know scripts are highly case sensitive but thats what it is on the form