- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2023 01:08 AM
Good Morning
I am trying to set the default value of a catalog item variable using the current logged in user details.
I can see this seems to be the common way of doing it :-
javascript:gs.getUser().getRecord().getValue("location");
But I want to populate the variable with a value from the location table not just the name of the location. How to I expand the line of script to pull field values from the location table?
Many Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2023 03:29 AM
I have actually resolved the issue using the "Auto-Populate" option on the variable. I had tried this initially and it did work, hence why i asked on the community. I then deleted the variable and recreated it and set the auto populated value again and it works as expected. Thank you all for you valued assistance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2023 01:36 AM
Hi @jonathangilbert,
You can use either
javascript:gs.getUser().getLocation();
OR
javascript:gs.getUser().getRecord().getValue('location');
It will brings value from location field in user table which is referenced form Location [cmn_location] table only.
If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers! 👍🏻
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2023 01:48 AM
Hi Sagar,
That is what I have, I wish to populate the value from the locations table, i.e fieldx, how do you expand the script?
Many Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2023 01:59 AM
Hi @jonathangilbert ,
I am not sure if that is possible. You can either use a on load script to fetch location information using GlideAjax call or u can directly call a script include in the default value tab.
Please mark my answer Helpful & Accepted if it addresses you issue.
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2023 03:29 AM
I have actually resolved the issue using the "Auto-Populate" option on the variable. I had tried this initially and it did work, hence why i asked on the community. I then deleted the variable and recreated it and set the auto populated value again and it works as expected. Thank you all for you valued assistance