Default values are set for logged-in users department. but If the user's department value is update

rui031
Tera Contributor

Hello.
I would like to set the default value for a variable in a catalog item to the department of the logged in user.

I tried "javascript:gs.getUser().getDepartmentID();" and the first time the default value was successfully entered into the form. However, after changing the user's department value, the value before the change continues to be entered as the default value.
Please let me know if there is a solution to this.

1 ACCEPTED SOLUTION

Community Alums
Not applicable

Hi @rui031 ,

You can set default values for your variables in variable set in variables default value tab.

Example : 

javascript:gs.getUserID();//will set logged-in user

javascript:gs.getUser().getCompanyID();//logged in user's company

 

For your Requirement 

 javascript:gs.getUser.getDepartmentID();

 

 

View solution in original post

2 REPLIES 2

Community Alums
Not applicable

Hi @rui031 ,

You can set default values for your variables in variable set in variables default value tab.

Example : 

javascript:gs.getUserID();//will set logged-in user

javascript:gs.getUser().getCompanyID();//logged in user's company

 

For your Requirement 

 javascript:gs.getUser.getDepartmentID();

 

 

shyamkumar VK
Kilo Patron

Hi @rui031 ,

 javascript:gs.getUser.getDepartmentID(); - you need to add this in default value of your variable and  this basically gets you the department of the logged user 

Can you clear this point --"after changing the user's department value, the value before the change continues to be entered as the default value."

 

you mean you have changed the department in user form?

Please mark this as helpful and accept as a solution if this resolves your Ask.
Regards,

Shyamkumar