Applies to:
Crow Canyon NITRO activated sites in:
SharePoint Online and On-Premises 2013/2016/2019/SharePoint Server Subscription Edition
Description
Lookup column shows lookup list items as per the selected ‘Lookup View’ in column settings. In case of multiple NITRO Forms configured for the list, it might be required to show different set of lookup list items based on the form key. This can be configured using custom script in NITRO Lookup column settings.
In this article, we have taken an example of ‘Category’ lookup column of the Tickets list. It is required to show ‘All Items’ lookup list view items for the ‘Tickets’ form and ‘Public View’ lookup list view items for the ‘PortalTicket’ form. Category list has two SharePoint list views, ‘All Items’ and ‘Public View’.
Detailed steps
- Add custom JavaScript to modify the ‘Category’ lookup column.
Navigate to NITRO Forms designer for the Tickets list -> Open ‘Tickets’ form -> Select ‘Category’ column -> Click ‘Edit’ button from column settings panel -> Scroll down and click ‘Add/Edit Script’ button from the ‘Advanced Settings’ section.
2. Specify the custom script.
There are two ways to modify the lookup view:
- By lookup view name
- By lookup view ID
- By lookup view name
Script:
var scriptManager = {};
//Modify the lookup view by view name.
scriptManager.UpdateLookupView = function(objData, objLookupSetting){
//Modify objLookupSetting properties.
var viewName = objLookupSetting.FilterView;
if (objData.FormKey === 'PortalTicket') {
viewName = 'Public View';
};
return viewName;
};
return scriptManager;
Note: Replace ‘PortalTicket’ form key and ‘Public View’ list view name as needed.

b. By lookup view ID
Navigate to ‘Category’ list -> Edit ‘Public View’ list view -> Copy view ID from address bar of the browser -> Specify view ID of ‘Public View’ in the script.

Script:
var scriptManager = {};
//Modify the lookup properties.
scriptManager.PreRenderLookup = function(objData, objLookupSetting){
//Modify objLookupSetting properties.
if (objData.FormKey === 'PortalTicket') {
objLookupSetting.FilterViewID = 'CC1CFE48-4011-4732-9611-98F5CE61F9D2';
};
return objLookupSetting;
};
return scriptManager;
Note:
- Replace ‘PortalTicket’ form key as needed.
- Replace ‘CC1CFE48-4011-4732-9611-98F5CE61F9D2’ with ‘Public View’ view ID as shown in the above screenshot.

3. Click Ok -> Click ‘Apply’ button -> Publish the NITRO Forms.