Cascading fields in sharepoint 2013
-
- Posts: 1
- Joined: Wed Nov 11, 2015
Hello , i installed like it 5 min ago your aplication "Manage PlusSail Lookups" and i will like it to know how is work!!
i want to insert a two fields type: lookup first is "MachineNr" and second one is "CustomerNr"
those two fields come form the same list name "Machine"
My plan is when i filter "Maschine" i want to see in "CustomerNr" your CustomerNr like the same machine before i filted
i can do it something like that with your aplication and how take you
regard
Hamlet Cabrera
i want to insert a two fields type: lookup first is "MachineNr" and second one is "CustomerNr"
those two fields come form the same list name "Machine"
My plan is when i filter "Maschine" i want to see in "CustomerNr" your CustomerNr like the same machine before i filted
i can do it something like that with your aplication and how take you
regard
Hamlet Cabrera
Hello,
If I understand correctly, the functionality you want is this: when the user selects MachineNr your CustomerNr to be set to the corresponding value from the same entity as the MachineNr.
In that case you need to:
1. In the list with the lookup fields click 'Manage Plumsail Lookups', select MachineNr, click advanced settings and change the Request items code in the following way:
We've added ",CustomerNr" to both queries here.
2. Then open up Forms Designer and add the following code to the JavaScript editor of the required form (New and/or Edit):
Note that MachineNr and CustomerNr are internal names, not titles of the fields (to check the internal name go to Forms Designer, click the field and check the grid to your right).
You may also want to have a look at this blog post here describing the setup of cascading dropdowns.
If I understand correctly, the functionality you want is this: when the user selects MachineNr your CustomerNr to be set to the corresponding value from the same entity as the MachineNr.
In that case you need to:
1. In the list with the lookup fields click 'Manage Plumsail Lookups', select MachineNr, click advanced settings and change the Request items code in the following way:
Code: Select all
function (term, page) {
if (!term || term.length == 0) {
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},CustomerNr&$orderby=Created desc&$top=10";
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},CustomerNr&$orderby={LookupField}&$filter=startswith({LookupField}, '" + encodeURIComponent(term) + "')&$top=10";
}
2. Then open up Forms Designer and add the following code to the JavaScript editor of the required form (New and/or Edit):
Code: Select all
fd.field('MachineNr').change(function(){
fd.field('CustomerNr').value(fd.field('MachineNr').control('data')['Id'] +';#' + fd.field('MachineNr').control('data')['CustomerNr']);
});
You may also want to have a look at this blog post here describing the setup of cascading dropdowns.
-
- Information
-
Who is online
Users browsing this forum: No registered users and 9 guests