Autopopulate the fields(country, Region) in catalog item as user login
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2024 03:02 AM
Hi everyone,
In catalog item for logged- in user country and region needs to be auto populated. we have a variable set were we get values of Requested for(user name from sys_user table) and location(deatils from cmn_loaction table) which is auto populated. In the same way need a onload client script to Auto Populate 'Country' and 'Region'(Single Line text fields) for logged in user (using the location field present in variable set).
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2024 03:09 AM
Hi @Sharada N S ,
If you are on the latest version of servicenow them you can make use of autopopulate table from variable dictonary. If not then you have to make use of client script to auto populate.
I hope this helps....
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2024 03:14 AM
Hi Thanks for ur reply
I need a client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2024 03:20 AM
Server side be like :
var grr = new GlideRecord('sys_user');
grr.addQuery('sys_id' <param value>);
grr.query();
if(grr.next()){
var obj = {};
ojb.country = grr.country.getDisplayValue();
obj.region = grr.region.getDisplayValue();
}
return obj;
On client script you can parse the json object and set the value...
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2024 07:43 AM
Hello @Sharada N S can you please tell us in which table region field is available?