- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2023 12:44 AM
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2023 12:55 AM
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();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2023 12:55 AM
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();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2023 01:04 AM
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?
Regards,
Shyamkumar