client script showing error on record producer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2024 01:48 AM
Hi Everyone,
I have requirement logged in user country should be map on "Country" variable which is single line text on record producer but im getting the sys id of logged in user not getting logged in user country name.
please see below screen shot.
please let me know what i need to change.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2024 01:54 AM
Hi @rmaroti
Change line 12 in the script include as:
var country = usr.location.country.toString()
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2024 01:56 AM
Hello @rmaroti
In the script include use this -
var country; //this variable should have to outside of if function
if(usr.next()){
country = usr.location.country.getDisplayValue(); //best way to use getDisplayValue()
}
return country;
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2024 01:58 AM
script include is correct im checking in background script and getting expected result but in client script it return logged in user sys_id instead of country.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2024 01:58 AM - edited 02-09-2024 01:59 AM
Hey @rmaroti ,
you need to parse the response properly, please have a look here:
AJAX Documentation
Regards, Ivan