Pre-populating your form controls with Query String


Userlevel 6
Badge +13

When prompting your users to fill in a form, it can be handy to sometimes help them out by filling in some of the information for them. You can do this by default values of course, but sometimes it needs to be more contextual.

 

For one solution I was working on, I had an issues list that I needed our users to populate as and when they encountered a bug, the issues would relate to an item that a workflow was running on, but the issue was being recorded on a separate list.

 

I built a link in the email the workflow would send them, prompting them to raise any bugs they found that looked like the following:

 

http://server/sites/sitename/lists/listname/NewForm.aspx?URL=www.google.co.uk&Status=New

 

Then, with Nintex forms, open your control properties and in the Default Value field add the Inline Function "fn-GetQueryString(URL)".

 

This would produce the following results when set for Site URL column and the Status column in the screenshot below. Obviously, you could do an awful lot more with this.

 

issuelist.PNG


15 replies

Badge +2

Very Nice!

Thanks for Sharing

Badge +1

Any idea how you can use fn-GetQueryString in a workflow? Here's what I'm trying to do: 

  1. Upload file to document library
  2. Extract the value of "RootFolder=" from the item's URL
  3. Store the value in another column in the library

I'm using Nintex Workflows with SharePoint 2013. 

Userlevel 6
Badge +13

As the URL element is contextual to the form rather than the item, I don't think you can. It's a runtime function and therefore needs to be done through the form. 

Maybe someone could do a test around whether a Nintex form will be able to do this on upload of document though? I can't at the moment I'm afraid.

Badge +3

Nice 🙂 !

Do you also know if it's possible for a list lookup control connected to a single line of text column?

Userlevel 6
Badge +13

I presume you mean you'd like to populate the list lookup control with the value from the query string?

Just having a look at the list lookup control, there doesn't appear to be a default value field that can be set for it (at least in O365 where I'm working) so probably not, at least not using the runtime function referenced in this blog.

Badge +3

I also tried to this by the possibility to set a default value in the column settings of the single line of text column. But the runtime functions cannot be used there.

Userlevel 6
Badge +13

No, the runtime functions are JavaScript functions built in to Nintex forms and won't work outside of the form. There is a query string filter webpart ootb with SharePoint, but it's only a filter for a list.

Badge +1

It looks like that works for text control, - but I can't seem to find a way to set the default value of a date control.

Userlevel 6
Badge +13

No, the date control won't allow you to do this. In the example shown, the date was defaulted to when a bug was reported (item created). The date control is quite limited from that aspect. Although you may be able to achieve this using JavaScript.

Badge +3

Hi all,

Just wondering  if you have come across the requirement of passing query string data on a repeating section? I need to populate repeating section data with this?

Userlevel 6
Badge +13

I've not come across this. I'm not sure how it would work as to build a repeating section you need to use XML normally, I'm not sure if the fn-GetQueryString is available in a repeating section, or a control within a repeating section, not got forms in front of me to check.

Generally any pre-building of repeating sections I've done by running a workflow to create the item and generate the XML needed to build a repeating section with existing data.

I'm not sure of your scenario though and whether this can help.

Badge +3

What I have above is a Nintex form which I need to populate using the Get query string function, I have been able to get the data to store in a form variable however where i got stuck is when I tried to:

1. name the repeating field, 

2. when you have multiple fields of repeating area the getquery string will set the values of all the fields the same as it is unable to differentiate the field name...

Ryan Greenaway‌ I have found that this doesn't seem to be working. I'm just getting "fn-GetQueryString(URL)" written in as editable text. I know I could make it disabled to stop the editing, but my query string variable doesn't seem to be picked up by the inline function. Also, I do not see GetQueryString as one of the default inline functions available.

Does anyone know if this feature's been removed?

Is there a difference between using this on the Classic and the Responsive forms?

Is a different version of Nintex required? I believe we have Nintex Live

Badge +3

I've been able to get this to work easily with Responsive forms but it doesn't appear to work at all on Classic forms - which are needed for Nintex Live and anonymous forms. That seems to really defeat my goal for sure.

I'm hoping to send the results from an anonymous form to a SharePoint Online list and perhaps a SQL database but so far - no luck.

I've found a javascript option on a few other forums but when I add it, I get a message that Nintext is out of date so I'm guessing it's pulling in old functions.

Badge +3

Did some more digging and I see the option in our on-premise install of Nintex but it doesn't appear to be an option for SharePoint Online.

That's a big bummer.

Reply