I'm trying to set a default value on a reference field called "u_director_name". When a user creates a Change Request I want the Director value [u_director] from their User record to pass to "u_director_name".

Lisa_Wiegmann
Giga Guru

I'm trying to set a default value on a reference field called "u_director_name".  When a user creates a Change Request I want the Director value [u_director] from their User record to pass to "u_director_name".  

1 ACCEPTED SOLUTION

Looks like maybe you've got some security settings getting in the way.  You'll probably need to create a script include with the 'gs.getUser().getRecord().getValue('u_director_name');' line I gave you before.  Then you can call your script include in your default value instead.  It's really simple to do.  Just set it up as shown here.

https://community.servicenow.com/community?id=community_question&sys_id=5ea11b6ddbdcdbc01dcaf3231f96197e

View solution in original post

10 REPLIES 10

Lisa_Wiegmann
Giga Guru

Looks like maybe you've got some security settings getting in the way.  You'll probably need to create a script include with the 'gs.getUser().getRecord().getValue('u_director_name');' line I gave you before.  Then you can call your script include in your default value instead.  It's really simple to do.  Just set it up as shown here.

https://community.servicenow.com/community?id=community_question&sys_id=5ea11b6ddbdcdbc01dcaf3231f96197e

Lisa_Wiegmann
Giga Guru

I still am not seeing a value.  Does it make a difference if u_director (on sys_user) contains the value I want, but it is not visible on the user record?  Here are my screen shots.

Your script include script should look like this...

function getDirector() {
    var director = gs.getUser().getRecord().getValue('u_director');
    return director;
}

 

Lisa_Wiegmann
Giga Guru

Thanks!  That did it.