I recently had request from a client to show current items in a list for users to preview as they created a new request. The actual requirement is listed below.
Requirement:
Allow users to view list items from the current list. Users should be able to enter the “ID” of the item they want to see in a field on the form, and the form should process and return the fields of the item they specified.
Diagnosis:
I know some people may be thinking about using views, filtering fields and using a query, or perhaps even using a lookup field to achieve the results. While there are a few different ways to achieve this that I explored, some with extra code, I decided to use a built in function that was native to Nintex that seems to fit the bill quite easily.
Solution:
The solution has a few pieces working together and could be greatly complicated depending on your list and form view, but here is what I did to show this functionality:
- Current List Form
- List View
- Labels
- Single line of text field (used to capture the ID to filter on)
That’s it. Seriously, that’s all I added, but it’s connecting them to make the solution work. I didn’t complicate it because I wanted to focus on the functionality, but there are plenty of additional things that can be done for this to make it nice! Please note this was configured for Nintex Forms on SharePoint Server 2013 using their trial version. So let’s see how I made this happen.
The first thing was to make a simple list. The list in this case was called “TestForm” and contained four fields:
- Title – default SP title field (Single line of text)
- Test1 – single line of text field •Test2 – single line of text field
- Test3 – choice field with drop down options (I used the default ones here for simplicity)
After creating the list, I created three test records to have available when I needed to test the form. So lets get started. Navigate to the ribbon and access the Nintex Forms button. Either click on the logo or Customize the Item Form as in the picture below.
Once the new form opens in Nintex designer, I started with the basic form and highlighted all the items, then dragged them down to create space for the new fields.
From the General section on the left, select the following: Single line of text and set the name to “SetID”. That’s all you need to do for now. SetID does not need to be connected to anything since it will temporarily store data we will use for filtering the list view.
From the SharePoint section on the left, select the following: List View. Access the settings and fill in the following information as below, or to match your site information.
You will see a warning bar in yellow, alerting you that some additional configuration is needed. So let’s see if we can get rid of that warning. See below:
- Source site: / I used the backslash to signify the root site. You can also click on the green arrow and it will bring up the sites that can be selected.
- List – this is the list name “TestForm” •View name – type in “All Items” for now. This takes straight text here so don’t use the “.aspx” name here
- Filter list items – “by a controls value” (this is where SetID comes to work)
- Where – “ID”
- Filtered by Control – “SetID”
- Resizing – “No”
So if you are following along you can now see that we want to display the list TestForm, where the items ID is equal to the value entered in the SetID field on the form. I also chose no resizing so the results would not overflow my form but stay within the boundaries I set.
Before going to far, let’s test this to see if it works. Navigate to Nintex Forms tab in the browser and hit preview. The reason for using the preview is that it gives you the ability to view your form without saving or publishing it. Saves you some time in case you don’t like the changes you made.
You should see something similar to the screenshot below. If not, go back and walk through the steps again.
While this does not look pretty, let’s enter a value to see if our setup worked. Hoorah! I hope yours worked. If not, shoot me a comment.
Fine Tuning:
Now that I know it works, I went back and added a few more things to make it look better and give the user a few instructions on how it works. Here’s what I did:
- Added a rule to the List View to only show when SetID was not empty or null. “isEmptyorNull(SetID)”
- Added a label with bold text set to 11 with the words “Enter ID below”
- Added another label with the instruction text
- Made the list view smaller so that only the title of the columns and the one line would show up.
That’s it “Simply #Ninticity”. You should be able to create a new item, enter the ID if you want to view the other items and proceed. Know of other things to make this look pretty? Leave a comment with any questions. Also tweet me your comments @Eharris04. This post can also be found on Summit 7 Systems website as well if you want to find other post similar to these.