client script showing error on record producer

rmaroti
Tera Contributor

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.

 

11 REPLIES 11

Aman Kumar S
Kilo Patron

Hi @rmaroti 

Change line 12 in the script include as:

var country = usr.location.country.toString()

Best Regards
Aman Kumar

Harsh_Deep
Giga Sage
Giga Sage

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.

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.

 

Ivan Betev
Mega Sage
Mega Sage

Hey @rmaroti ,

 

you need to parse the response properly, please have a look here:

AJAX Documentation 

 

IvanBetev_0-1707472762595.png

 

Regards, Ivan