Filter Cross site lookups - Loading failed
Hi Roo,
I have tested your solution and I would recommend two ways to solve this issue:
1) Add a departments list instead of a choice field. Then your code is correct and should work as in the example: https://spform.com/cross-site-lookup/ca ... office-365
2) Copy a choice field on the site without using lookup. Then you can filter your employee field by using filtering by a choice field: https://spform.com/cross-site-lookup/fi ... ite-lookup
I have tested your solution and I would recommend two ways to solve this issue:
1) Add a departments list instead of a choice field. Then your code is correct and should work as in the example: https://spform.com/cross-site-lookup/ca ... office-365
2) Copy a choice field on the site without using lookup. Then you can filter your employee field by using filtering by a choice field: https://spform.com/cross-site-lookup/fi ... ite-lookup
(sorry for the delay - I've been away)
Reading through both options I think the second would be more suitable for my task.
In the example given it purely uses a check box as an example. How would I create the same if a (Text) choice option was to be used?
Example given:
// Checking the checkbox
var check = fd.field('Check').value() ? 1 : 0;
My Columns will show : (and more eventually)
IT
MAINTENANCE
MILL WARPING
PURCHASING
RESEARCH & DEVELOPMENT
SHOP
Reading through both options I think the second would be more suitable for my task.
In the example given it purely uses a check box as an example. How would I create the same if a (Text) choice option was to be used?
Example given:
// Checking the checkbox
var check = fd.field('Check').value() ? 1 : 0;
My Columns will show : (and more eventually)
IT
MAINTENANCE
MILL WARPING
PURCHASING
RESEARCH & DEVELOPMENT
SHOP
His is the solution:
function (term, page) {
// Getting the selected department on the form
var department = fd.field('Department').value();
if (!term || term.length == 0) {
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby={LookupField}&$filter=Department eq '" + department + "' &$top=10";
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby={LookupField}&$filter=startswith({LookupField}, '" + encodeURIComponent(term) + "') and Department eq '" + department + "' &$top=10";
Thanks Nikita
function (term, page) {
// Getting the selected department on the form
var department = fd.field('Department').value();
if (!term || term.length == 0) {
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby={LookupField}&$filter=Department eq '" + department + "' &$top=10";
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby={LookupField}&$filter=startswith({LookupField}, '" + encodeURIComponent(term) + "') and Department eq '" + department + "' &$top=10";
Thanks Nikita
-
- Information
-
Who is online
Users browsing this forum: No registered users and 11 guests