Script Include return always the same value

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2024 06:57 AM
Hi All,
I have an issue with Script Include - it always return the same value of this variable "iso_short", no matter which value is this variable "name" on this table "core_country "
Script include :
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2024 07:00 AM
your code will work fine if u_country field on sys_user is referring to core_country table?
if it's reference then simply dot walk and get the value
var user = new GlideRecord("sys_user");
if (user.get(this.getParameter('user') + "")) {
var result = this.newItem("result");
//Récupération du CountryCode
result.setAttribute("country", user.u_country.iso_short + "");
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2024 07:04 AM
Hi Ankur , thank you for your reply but
it's return : undefined

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2024 07:06 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2024 09:18 AM
Did you put logs and check for iso value in script include?