How to create and get the key and value from List Lookup control?


Badge +1

We are using Nintex form with SharePoint. Suppose we have two lists ABC and XYZ. On list ABC we have nintex form with list lookup control which is associated with list XYZ. In list XYZ we have many columns including EmpId and EmpName. We want to do like this html select - Get selected key/value of a combo box using jQuery - Stack Overflow .We want to create list lookup control such a way that while displaying results it should display values from EmpName column and while retrieving values in javascript/jquery it should retrieve values from EmpId column. How to create list lookup control with such key value pair and retrieve results using key value pair?


3 replies

Userlevel 5
Badge +14

that's how lookups work by default. you do not need implement any extra logic so that you show (text) value but query by ID.

value of lookup control is always in a form: ID;#textvalue

to get one or the other part out of it use parseLookup() function

Badge +1

Thanks for reply I am getting ID in JavaScript but it is out of box sharepoint column 'ID'. I want EmpId in JavaScript. How to do that?

Userlevel 5
Badge +14

ok, I see.

but if you have lookup field configured in list it will anyway make a link/search with internal ItemID and not with your custom EmpID.

imho, you do not need to bother with EmpID at all.

Reply