Cascading dropdowns issue
Posted: 23 Mar 2017
Hi,
I'm new to Forms Designer and my company is testing this out. On our SP2013 site, I have created a list, let's call it 'Test Tasks'. In this list, I have two dropdowns, one for 'Customer' and one for 'Project'. These are both lookup columns to respectively named lists. In the 'Projects' list there is a link to 'Customer'.
What I'm trying to accomplish is:
When creating a new item in the 'Test Tasks' list, I would like to select a Customer and have that filter the Projects dropdown. I believe this is what you call 'Cascading Dropdowns'. I have tried to use the method described here: https://spform.com/cross-site-lookup/ca ... office-365, but I just can't get it to work. This is what I have so far:
I don't think this script is entirely correct, but I'm not sure as how to improve it. Also, if I am on the 'new form' for 'Test Tasks' and I F12 in the browser I see this an error saying 'Uncaught SyntaxError: Unexpected Token '('' -> referring to the first '(' after 'function'.
This feature is a great incentive for us to buy this tool, but we need to know beforehand if it will even work. Thanks in advance for your efforts!
Kind regards
I'm new to Forms Designer and my company is testing this out. On our SP2013 site, I have created a list, let's call it 'Test Tasks'. In this list, I have two dropdowns, one for 'Customer' and one for 'Project'. These are both lookup columns to respectively named lists. In the 'Projects' list there is a link to 'Customer'.
What I'm trying to accomplish is:
When creating a new item in the 'Test Tasks' list, I would like to select a Customer and have that filter the Projects dropdown. I believe this is what you call 'Cascading Dropdowns'. I have tried to use the method described here: https://spform.com/cross-site-lookup/ca ... office-365, but I just can't get it to work. This is what I have so far:
Code: Select all
function (term, page) {
var CustomerId = fd.field('Customer').value();
alert(CustomerId );
if (!CustomerId ) {
CustomerId = 0;
}
if (!term || term.length == 0) {
return "myOwnSPSiteUrl/_api/web/lists('Test task list ID')/items?$select=Id {LookupField},Customer/Id&$orderby=Titleasc&$expand=Customer/Id&$filter=Customer/Id eq " + CustomerId +"$top=10";
}
return "myOwnSPSiteUrl/_api/web/lists('Test Task list ID')/items?$select=Id,Project&$orderby=Project&$filter=startswith(Project, '" + encodeURIComponent(term) + "')&$top=10";
}
This feature is a great incentive for us to buy this tool, but we need to know beforehand if it will even work. Thanks in advance for your efforts!
Kind regards