Hi, is there any posibility to filter lookup based on what I type in?
I have lookup connected to external list with all employees, but I cant figure it aout how to filter those employees, so I would't have to scroll them all the way.
Maybe it's dumb question, but I will apreciate the solution if there is one.
Thanks, Michal.
Hi @Multihunter,
You can filter a lookup based on a different field on your form. Here's how: Filter Lookup by another field: Lookup, Person, Choice — Plumsail SharePoint Forms Documentation
Let me know if this helps.
Yes @IliaLazarevskii , it definetly helped, thanks!
Here is my situation:
I have lookup connected to employee database so I can now find the employee through this column that contains (Surname, First Name and Pin) of all emloyees and now I have another fields that i want to populate from this item like division, branch, country etc.. Any sugestions on that?
Thanks in advance. Michal.
Hi @Multihunter,
You can retrieve extra fields from the list with a Lookup control as described here. Then, access them like this:
fd.field('Field1').value.extraField
(You need to replace extraField with the actual name of the field)
Hi @IliaLazarevskii ,
here are some pictures for better imagination.
When I click on some employee from the lookup I want to fill other fields, so my question is how do I get the access to columns of list of this item that I specified in Extra fields.
Sorry if my question is dumb, but my head is kind of overwhelmed.
Thanks in advance.
You mean something like this?
Hi @Multihunter,
Exactly. You need to use the spRendered() and $on() functions to address the fields on the form like this:
fd.spRendered(() => {
// update fields whenever the lookup changes
fd.field('EmployeeLookup').$on('change', () => {
var FirstName = fd.field('EmployeeLookup').value.first_name; // retrieve the extra field; make sure that you copy the name "first_name" from SharePoint
fd.field('FirstName').value = FirstName; // set the value of any field to the retrieved extra field
// handle the rest of the fields here
});
});
You can learn more on the topic from our documentation: Lookup field — Plumsail SharePoint Forms Documentation
Hi @IliaLazarevskii ,
I tried as you said, but I'm getting always whis error:
any sugestions? Thx
Here is the URL that I'm fetching:
Hi @Multihunter,
This error could appear either because you're using a lookup control and not a lookup field. If that's the case, please replace fd.field('EmployeeLookup') with fd.control('EmployeeLookup').
Other than that, ensure that the name of the lookup is the same as in the editor.
1 Like
Hi @IliaLazarevskii ,
thanks for your patience, now it works perfectly.
Maybe it will be good to correct the documentation about Lookup field.
Michal