Please help with populating assigned to field with Catalog Client Script

Meera_P
Tera Expert

Hello,

Please help with populating assigned to field with login user name when form is loading.

 

I have tried the following script, but was not successful.  Please help.  Thank you

 

 

 

function onLoad() {
   //Type appropriate comment here, and begin script below
   var loginName = g_user.firstName+' '+g_user.lastName;
   g_form.setValue('Assigned_to', loginName);
   
}

 

 

 

1 ACCEPTED SOLUTION

Brad Bowman
Kilo Patron
Kilo Patron

If you're referring to the Assigned to field on the task table (or incident, problem, change, requested item, ...) the field name is assigned_to, and it requires a sys_id for its value, so your script would look more like this:

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

View solution in original post

3 REPLIES 3

Brad Bowman
Kilo Patron
Kilo Patron

If you're referring to the Assigned to field on the task table (or incident, problem, change, requested item, ...) the field name is assigned_to, and it requires a sys_id for its value, so your script would look more like this:

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

Hi @Brad Bowman  

Thank you for your assistance! I gained a lot of knowledge from the community.

You are welcome! Happy to help!