Skip to main content
Nintex Community Menu Bar

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:

ehnin1.png

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:

  1. Current List Form
  2. List View
  3. Labels
  4. 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.

 

ehnin2.png

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.

ehnin3.png

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.

ehnin4.png


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.

ehnin5.png

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.

ehnin6.png

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:

ehnin7.png

  • 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.

ehnin8.png

You should see something similar to the screenshot below.  If not, go back and walk through the steps again.

ehnin9.png

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.

ehnin10.png

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:

ehnin11.png

  1. Added a rule to the List View to only show when SetID was not empty or null. “isEmptyorNull(SetID)”
  2. Added a label with bold text set to 11 with the words “Enter ID below
  3. Added another label with the instruction text
  4. 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.

Is possible to add a button next to the ID field that will populate the view when clicked. It would be more presentable than having to click the white space for the list items to appear.


Hey Eric Harris‌,

Assuming I am not searching by ID but instead want to filter by another column, do you know of a way to limit the results e.g. to only the top 5?


@Eric Harris

  Hi Eric ;

 I do what you do exactly and when I click view and write for example number 2 then enter , error comes , I see the log like the following:

Area     : SharePoint Foundation
Category : Logging Correlation Data
Level    : Medium
EventID  : xmnv
Message  : Name=Request (POST:http://picspdv01:28129/_layouts/15/NintexForms/Pr
           eviewNintexForm.aspx?device=Desktop&mode=1&listId=41782706-fdfb-49f1
           -9830-ebbcda278d5f&env=0&formId=ce8b1116-40cb-4a95-911b-44e3b18ab211
           &IsDlg=1)

Area     : SharePoint Foundation
Category : Authentication Authorization
Level    : Medium
EventID  : agb9s
Message  : Non-OAuth request. IsAuthenticated=True,
           UserIdentityName=0#.w|pic-kwtoma9999, ClaimsCount=29

Area     : SharePoint Foundation
Category : Logging Correlation Data
Level    : Medium
EventID  : xmnv
Message  : Site=/

Area     : SharePoint Foundation
Category : Monitoring
Level    : High
EventID  : b4ly
Message  : Leaving Monitored Scope (EnsureListItemsData). Execution Time=5.7797

Area     : SharePoint Foundation
Category : Files
Level    : High
EventID  : ak8dj
Message  : UserAgent not available, file operations may not be optimized.   
           at Microsoft.SharePoint.SPFileStreamManager.CreateCobaltStreamContai
           ner(SPFileStreamStore spfs, ILockBytes ilb, Boolean
           copyOnFirstWrite, Boolean disposeIlb)     at Microsoft.SharePoint.SP
           FileStreamManager.SetInputLockBytes(SPFileInfo& fileInfo,
           SqlSession session, PrefetchResult prefetchResult)     at Microsoft.
           SharePoint.CoordinatedStreamBuffer.SPCoordinatedStreamBufferFactory.
           CreateFromDocumentRowset(Guid databaseId, SqlSession session,
           SPFileStreamManager spfstm, Object] metadataRow, SPRowset
           contentRowset, SPDocumentBindRequest& dbreq, SPDocumentBindResults&
           dbres)     at
           Microsoft.SharePoint.SPSqlClient.GetDocumentContentRow(Int32
           rowOrd, Object ospFileStmMgr, SPDocumentBindRequest& dbreq,
           SPDocumentBindResults& dbres...

Area     : SharePoint Foundation
Category : Files
Level    : Medium
EventID  : aiv4w
Message  : Spent 16 ms to bind 43022 byte file stream

Area     : SharePoint Foundation
Category : Database
Level    : High
EventID  : ahjqp
Message  : sForced due to logging gap, cached @ 02/06/2017 10:52:31.20,
           Original Level: Verbose] SQL connection time: 0.071 for Data
           Source=PICSPDV01;Initial Catalog=WSS_Content_ICTMallah;Integrated
           Security=True;Enlist=False;Pooling=True;Min Pool Size=0;Max Pool
           Size=100;Asynchronous Processing=True;Connect
           Timeout=15;Application
           Name=SharePointnw3wp]>2]pWSS_Content_ICTMallah]

Area     : SharePoint Foundation
Category : Web Controls
Level    : High
EventID  : ad9g2
Message  : nForced due to logging gap, Original Level: Verbose] QoS data point
           list: "]

Area     : Nintex Forms
Category : Front End
Level    : Unexpected
EventID  : 00000
Message  : Error filtering the list view control:
           System.ArgumentNullException: Value cannot be null.  Parameter
           name: staticName     at
           Microsoft.SharePoint.SPFieldCollection.GetField(String strName,
           Boolean bThrowException)     at Nintex.Forms.SharePoint.NfsFilterUti
           lities.GetFilterCondition(SPList list, String fieldName, Object
           value, LookupFilterMode filterMode)     at Nintex.Forms.SharePoint.F
           ormControls.ListViewFormControl.ProcessFilter(String filterField,
           Object filterValue, LookupFilterMode filterMode)     at Nintex.Forms
           .SharePoint.FormControls.ListViewFormControl.FilterView()

Area     : SharePoint Foundation
Category : General
Level    : Medium
EventID  : 8nca
Message  : Application error when access
           /_layouts/15/NintexForms/PreviewNintexForm.aspx, Error=Failed to
           load viewstate.  The control tree into which viewstate is being
           loaded must match the control tree that was used to save viewstate
           during the previous request.  For example, when adding controls
           dynamically, the controls added during a post-back must match the
           type and position of the controls added during the initial request.
             at System.Web.UI.Control.LoadViewStateRecursive(Object
           savedState)     at System.Web.UI.Control.AddedControl(Control
           control, Int32 index)     at Nintex.Forms.SharePoint.FormControls.Li
           stViewFormControl.FilterView()     at
           System.Web.UI.Control.PreRenderRecursiveInternal()     at
           System.Web.UI.Control.PreRenderRecursiveInternal()     at
           System.Web.UI.Control.PreRenderRecu...

Area     : SharePoint Foundation
Category : Runtime
Level    : Unexpected
EventID  : tkau
Message  : System.Web.HttpException: Failed to load viewstate.  The control
           tree into which viewstate is being loaded must match the control
           tree that was used to save viewstate during the previous request. 
           For example, when adding controls dynamically, the controls added
           during a post-back must match the type and position of the controls
           added during the initial request.    at
           System.Web.UI.Control.LoadViewStateRecursive(Object savedState)    
           at System.Web.UI.Control.AddedControl(Control control, Int32 index)
               at Nintex.Forms.SharePoint.FormControls.ListViewFormControl.Filt
           erView()     at System.Web.UI.Control.PreRenderRecursiveInternal() 
              at System.Web.UI.Control.PreRenderRecursiveInternal()     at
           System.Web.UI.Control.PreRenderRecursiveInternal()     at
           System.Web.UI.Control.PreRenderRecu...

Area     : SharePoint Foundation
Category : General
Level    : High
EventID  : ajlz0
Message  : Getting Error Message for Exception
           System.Web.HttpUnhandledException (0x80004005): Exception of type
           'System.Web.HttpUnhandledException' was thrown. --->
           System.Web.HttpException (0x80004005): Failed to load viewstate. 
           The control tree into which viewstate is being loaded must match
           the control tree that was used to save viewstate during the
           previous request.  For example, when adding controls dynamically,
           the controls added during a post-back must match the type and
           position of the controls added during the initial request.     at
           System.Web.UI.Control.LoadViewStateRecursive(Object savedState)    
           at System.Web.UI.Control.AddedControl(Control control, Int32 index)
               at Nintex.Forms.SharePoint.FormControls.ListViewFormControl.Filt
           erView()     at System.Web.UI.Control.PreRenderRecursive...

Area     : SharePoint Foundation
Category : General
Level    : Monitorable
EventID  : aat87
Message  :

Area     : SharePoint Foundation
Category : Micro Trace
Level    : Medium
EventID  : uls4
Message  : Micro Trace Tags: 0 nasq,2 agb9s,44 b4ly,3 ak8dj,124 8nca,0 tkau,0
           ajlz0,1 aat87

Area     : SharePoint Foundation
Category : Monitoring
Level    : Medium
EventID  : b4ly
Message  : Leaving Monitored Scope (Request (POST:http://picspdv01:28129/_layou
           ts/15/NintexForms/PreviewNintexForm.aspx?device=Desktop&mode=1&listI
           d=41782706-fdfb-49f1-9830-ebbcda278d5f&env=0&formId=ce8b1116-40cb-4a
           95-911b-44e3b18ab211&IsDlg=1)). Execution Time=191.47

Any help pls???


Reply