The Zurich release has arrived! Interested in new features and functionalities? Click here for more

How to access user info in a workflow script

Michael M1
Giga Expert

I have a catalog item where one of the variables is to select a user from sys_user table (workflow.variables.u_user).

How can I get the value of a custom date attribute (u_expires) of that user in the workflow?

If I enter the following variables into a log statement:

var current = workflow.variables.u_user;
var thename = current.getDisplayValue();  
var expy = gs.getUser().getUserByID('current').getRecord().getValue('expires');
var expy2 = gs.getUser().getUserByID('current').getEmail();

 

current displays a sys_id
thename displays the user's name correctly
expy is undefined 
expy2 is null

 

How can I access the variable from the sys_id?

9 REPLIES 9

Michael M1
Giga Expert

FYI, also:

If I log:

var expires = current.u_expires

It is null.

I should be able to dot-walk, no?

dvp
Mega Sage
Mega Sage

Try

var expy = current.variables.u_user.u_expires

No. Says it is undefined.

I even tried current.variables.u_user.title just so I can have a good field and it was undefined also.

I print the sys_id of u_user (bc820c0ddbf26fc4ed2d8a50399619f1) and verify that this is the correct user and it is. I should be able to dot-walk but keep getting undefined.

 

What's datatype of u_expires on sys_user table?

 

Regards,

Sachin