Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Populate the location based on country

Haresh Haru
Tera Expert

Hello @Sagar Pagar ,

 

I have requerement like in catalog item we have two fields called county and location both are referenced by cmn_location table so if i select country field as india then it show the only india based locations like bangalore, hyd ect ...

So can please help me on this ....

 

Regards

Haresh

1 ACCEPTED SOLUTION

Hi @Haresh Haru,

 

Make sure that the variables name are correct.

Both are referenced to the same table i.e. cmn_location. hence you need to query with country column.

 

javascript:if(current.variables.country_variable_name != ''){
"country=" + current.variables.country_variable_name.country;
}

 

 

If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers! 👍🏻
Thanks,
Sagar Pagar

The world works with ServiceNow

View solution in original post

6 REPLIES 6

Siva Jyothi M
Mega Sage

Hi @Haresh Haru,

 

Yes, we can achieve this.

Try adding this in the Reference qual of the Location field:

 

javascript: 'country_table_field=' + current.variables.coutnry_form_field;

 

 

Mark this answer as correct and helpful if it solves your issue.

 

Regards,

Siva Jyothi M.

Sagar Pagar
Tera Patron

Hi @Haresh Haru,

 

You need to control it through the advanced reference qualifier as

 

javascript:if(current.variables.country != ''){
"country=" + current.variables.country;
}

 

If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers! 👍🏻
Thanks,
Sagar Pagar

The world works with ServiceNow

Haresh Haru
Tera Expert

Hello @Sagar Pagar , @Siva Jyothi M ,

 

I tried both codes in advanced reference qualifier but its not worked as expected as its showing the all locations erespective of the country...

 

Regards

Haresh

Hi @Haresh Haru,

 

Make sure that the variables name are correct.

Both are referenced to the same table i.e. cmn_location. hence you need to query with country column.

 

javascript:if(current.variables.country_variable_name != ''){
"country=" + current.variables.country_variable_name.country;
}

 

 

If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers! 👍🏻
Thanks,
Sagar Pagar

The world works with ServiceNow