The form has been closed – go back to library

When using InfoPath forms, and Nintex workflow, there are a few ways to view the InfoPath form.  You can either :

  1. Open the form by clicking on the link within the form library – and do save/submit, etc – and you’re redirected back to the form library
  2. Click on a link as generated by an Email (item URL within Nintex) – and do save/submit – and you get “Form was closed” – annoying ??!?

image

My recent customer was asking if they could auto-direct back to the Forms Library after saving the form – so I did some checking of the URL’s.

When you click on the form as in #1 above – this is the URL :

http://server/site/_layouts/FormServer.aspx?XmlLocation=/site/FormLib/FormName.xml&ClientInstalled=true&Source=https%3A%2F%2Fserver%2Fsite%2FFormLib%2Fdefault%2Easpx&DefaultItemOpen=1

BUT – when clicking the email link – as generated by Nintex Workflow (using the “Item URL” variable) – you get this :

http://server/site/_layouts/FormServer.aspx?XmlLocation=/site/FormLib/FormName.xml&OpenIn=browser

Notice anything missing ??

The basic problem is that one of the ‘QueryString’ values is missing – ie. the “SOURCE” list.    This is a ‘url-encoded’ name-of-page-to-redirect-back-to.

So – to solve the problem at hand – I did the following :

  • Within Nintex Workflow, create a variable called FormUrl (as opposed to ItemUrl)
  • Add a Build String activity (at the start)
  • Include the “ItemUrl” – and then…
  • &Source=https%3A%2F%2Fserver%2Fsite%2FFormLib%2Fdefault%2Easpx
  • Store the value into “FormUrl”
  • Whenever needing to send the URL in an email – just use my custom variable (FormUrl) – not ItemUrl.

Keep in mind that you need to change the “Source” url – depending on the library name and/or site – OR – you could re-direct back to the home page for the intranet after completed.

That works nicely – and people don’t get the dud “Form has been closed” screen after saving & submitting – when viewing the form via Email Link (ItemUrl).

Smile

Advertisements

One thought on “The form has been closed – go back to library

  1. Nice tip. Just to add, FormServer understands a few shortcuts like ~site or ~sitecollection in the QueryString. So you can write Source=~site/ and it’ll take you back to the welcome page of the current site.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s