How to auto populate the country code in phone number variable in catalog item

Sri56
Tera Contributor

Hi All,

Can anyone please help me on how to auto populate the country code in phone number variable in catalog item.

Thanks,

Sri

1 ACCEPTED SOLUTION

Harsh Vardhan
Giga Patron

Do you want to populate the country code based on logged in user ?

if yes you can write glide ajax here , and call it in your client script to set it at beginning of the value.

 

https://docs.servicenow.com/bundle/geneva-servicenow-platform/page/script/server_scripting/reference... 

View solution in original post

4 REPLIES 4

Varsha21
Giga Guru

Hi 

could you please provide screen shot for variable ?

 

Sri56
Tera Contributor

Please find the below screenshot.

find_real_file.png

Rahul Kumar17
Tera Guru

hi,

write default value of the variable

javascript: var countryCode; var user = new GlideRecord('sys_user'); if (user.get(gs.getUserID())) {countryCode = user.country}; countryCode;

If my response helped please mark it correct and close the thread.

Thanks,
Rahul Kumar

Harsh Vardhan
Giga Patron

Do you want to populate the country code based on logged in user ?

if yes you can write glide ajax here , and call it in your client script to set it at beginning of the value.

 

https://docs.servicenow.com/bundle/geneva-servicenow-platform/page/script/server_scripting/reference...