Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

Country field

Vinya Jakkula
Tera Contributor

Hi Team,

Can anyone help me country name is Korea, Republic of. but it is splitting up into choices.one is Korea and other is Republic of. What could be the reason.

4 REPLIES 4

Ankur Bawiskar
Tera Patron

@Vinya Jakkula 

where is this happening?

any script doing this? share some screenshots

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

var getemployeecountryandstate = Class.create();
getemployeecountryandstate.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
 
    populatedCountry: function() {
var employee = this.getParameter('sysparm_employee');
var gr = new GlideRecord('sys_user');
gr.addQuery('sys_id', employee);
gr.query();
if(gr.next()){
return gr.location.country + ',' + gr.location.state + ',' + gr.location.city;
},
 
populateDestinationState: function(){
var array = [];
var country = this.getParameter('sysparm_country');
var gr = new GlideAggregate('cmn_location');
gr.addQuery('stateISNOTEMPTY');
gr.addEncodedQuery('country=' + country);
gr.addAggregate("COUNT");
        gr.groupBy("state");
gr.orderBy();
gr.query();
while (gr.next()) {
                array.push(gr.state.toString());
            }
return array.join(',');
},
 
populateDestinationCountries: function(){
var array1 = [];
// var country = this.getParameter('sysparm_country');
var gr = new GlideAggregate('cmn_location');
gr.addEncodedQuery('countryISNOTEMPTY');
gr.addAggregate("COUNT");
        gr.groupBy("country");
gr.orderBy();
gr.query();
while (gr.next()) {
                array1.push(gr.country.toString());
            }
return array1.join(',');
},
    type: 'getemployeecountryandstate'
});

@Vinya Jakkula 

did you check what value is stored in country field on cmn_location table?

whatever value is present in field will come in the script

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar please help