Based on the Opened for i want to use the onLoad script to auto populate the values

kranthi2
Tera Expert

Hi,

Based on the Opened for i want to auto populate the Issue location, CCID, Simphony ID which are part of User table

 

here the condition would be i want to use only onLoad() client script, because i have used the auto populate option to populate but while i am impersonation or login as a user it is not working.

 

kranthi2_0-1705630930324.png

 

please advise how to create it by using the onLoad() client script

 

Thanks,

 

7 REPLIES 7

Tai Vu
Kilo Patron
Kilo Patron

Hi @kranthi2 

You can use Auto-populate feature within the variable without scripting.

Screenshot 2024-01-19 at 10.53.26.png

 

To autofill the Requestor (Opened for) when opening the form you can try this in the Default value of the variable.

javascript:gs.getUserID();

Screenshot 2024-01-19 at 10.54.25.png

 

Cheers,

Tai Vu 

Hi @Tai Vu 

Yes you are correct i have used the same but it is not working if i login as a end user 

but if i change the opened for it is working fine.

 

Please help me out the onLoad script for the same.

 

Thanks,

Hi @kranthi2 

The default value should work, maybe you can debug by trying to put a specific sys_id there.

Regarding the onload client script, you can try below

function onLoad() {
   g_form.setValue('opened_for', g_user.userID);
}

 

Cheers

Tai Vu