Hi,
Please follow the below steps.
Step 1: On the web template of the webpage we will retrieve the data according to the condition using fetch xml.
WebPage => Page Template => Web Template
{% assign completeurl = request.url %}
{% assign pathquery = request.path_and_query %}
{%assign conditionParameter = request.params.id%}
{% fetchxml fetchquery %}
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="new_testcity">
<attribute name="new_testcityid" />
<attribute name="new_name" />
<attribute name="createdon" />
<order attribute="new_name" descending="false" />
<filter type="and">
<condition attribute="new_name" operator="eq" value="{{ conditionParameter }}" />
</filter>
</entity>
</fetch>
{% endfetchxml %}
{% if page.adx_entityform %}
{% entityform id: page.adx_entityform.id %}
{% endif %}
<div style="display:none;">
<select id="mycity" >
{% for item in fetchquery.results.entities%}
<option value={{item.new_testcityid}}>{{item.new_name}}</option>
{% endfor%}
</select>
</div>
NOTE : 1) {%assign conditionParameter = request.params.id%} will get the id value from query string.
2) Pass the conditionparameter according to your fetchxml.
Step 2: On the webpage In the Advanced tab in the Custom javascript field paste the following code:
window.onload = function () {
$('#new_city').children('option:not(:first)').remove();
$("#mycity > option").each(function() {
$("#new_city").append('<option value="'+this.value+'">'+this.text+'</option>');
});
};
Note: This javascript function removes all the <option> tags from the $('#new_city') outbox of box field i.e. ookup dropdown and replace it with the <option> tag created in step1 liquid code $("#mycity").
Thanks!