Im currently migrating a form from Forms Designer to Plumsail Forms 3. On the old form we used Plumsail Lookups to filter a dropdown 'equipment' based on the chosen option from the 'site' dropdown. The site dropdown has an option 'All Sites' which was used to remove any site filter from the equipment dropdown, displaying all equipment items irrespective of related site. Old code below:
function (term, page) {
// Getting the selected facility
var facilityId = fd.field('Site').value();
if (!facilityId) {
facilityId = 0;
}
// No site filter
if (facilityId == 11) {
if (!term || term.length == 0) {
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Site/Title&$expand=Site/Title&$orderby={LookupField}&$top=40";
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Site/Title&$expand=Site/Title&$orderby={LookupField}&$filter=substringof('" + encodeURIComponent(term) + "', {LookupField})&$top=40";
}
// Filtering by the selected facility
if (!term || term.length == 0) {
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Site/Id,Site/Title&$orderby={LookupField}&$expand=Site/Id,Site/Title&$filter=Site/Id eq " + facilityId + "&$top=40";
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Site/Id,Site/Title&$orderby={LookupField}&$expand=Site/Id,Site/Title&$filter=substringof('" + encodeURIComponent(term) + "', {LookupField}) and Site/Id eq " + facilityId + "&$top=40";
}
How can I achieve the same result in Plumsail Forms 3? Ive currently got the following options set on the equipment dropdown: