Link to a Specific InfoPath View
In many cases in InfoPath, especially when testing, it is helpful to be able to click to go directly to a specific view of a form. Of course, you can always insert a button in a form whose action is to switch views, and use a formatting rule to only show that button to certain people. This is what I’ve been doing for years, but in this blog post I’m going to show you a different trick that lets you create a hyperlink directly to a specific view of in a form.
It is a query string parameter, and the syntax is:
When you click to create a new browser-based form, here is an example of the URL you will see in the address bar:
Normally, when formulating a link to a form, I’ll take the above and trim it down a bit.
- I usually only include a submit button in the form and not a save button, so &SaveLocation isn’t needed.
- Also, I usually change the &Source to take you back to the main page after filling out the form. In this case, the site I want to be redirected back to is http://portal.contoso.com/demo.
- I’ve found that when I keep it browser-based, the &ClientInstalled isn’t needed.so the URL is:
In a lot of cases when testing a new form, I’ll create a view called ADMIN, and just dump all the form’s fields on it. This way, I can troubleshoot any validation errors, rules, etc. Here is how to formulate the hyperlink to open a new form directly this ADMIN view. Note that this DefaultView parameter only works with a new form, and not on already existing ones.
It doesn’t appear to work when you put it at the very end of the URL, so it needs to go before the DefaultItemOpen. So now that you know what the syntax is, I’ll tell you about another example of a case in which I’ve used it.
I have a view in an expense form that is the most commonly used view. Then, I have another view that’s not the default, that’s called “New”, and it is a very trimmed down view with only a handful of fields that the initiator can fill out. Once the initiator has filled out some basics, this form goes through a workflow and approval process, and the initiator is not privy to that whole process. In this case, I created a big pretty button on the homepage for “New Expense Report” and used the hyperlink (that last example above), with the default view being set to the New view. They fill it out and are immediately redirected to the homepage. People love pretty buttons. I just use the Content Editor web part for this:
More Info: I’ve written a couple of blog posts that are related to this topic: