How to open InfoPath form in browser from workflow status page even though InfoPath client is installed

In our project we have browser enabled InfoPath form and workflow. Whenever we tried to open InfoPath form from workflow status page (WrkStat.aspx) page, if InfoPath client is installed on client machine then it always opened InfoPath form in InfoPath client even though InfoPath form is browser enabled. Our customer has requirement that InfoPath form must be opened in browser irrespective of InfoPath client is installed or not. So after doing research we found an alternative, if we add a query string parameter to InfoPath form XML URL, ?OpenIn=Browser then InfoPath form always opens in browser even though InfoPath client is installed. Now to implement this solution we have two options,

<!–[if !supportLists]–>

1.

<!–[endif]–>

Either modify OOB workflow status page

<!–[if !supportLists]–>

2.

<!–[endif]–>

Copy and have our own separate workflow status page and then change it Definitely first option is not the recommended solution. So we copied OOB workflow status page and then modified it. In workflow status page, there is variable called StrUrlItem which contains the URL of InfoPath form xml. The original code is like<% if (!string.IsNullOrEmpty(StrUrlItem)) { %> onclick=<%SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(StrOnClickItem),Response.Output);%>> <% } SPHttpUtility.HtmlEncode(StrNameItem,Response.Output); if (!string.IsNullOrEmpty(StrUrlItem)) { %> <% } %>So we changed the above code and made it as follows<% if (!string.IsNullOrEmpty(StrUrlItem)) { StrUrlItem = StrUrlItem + “?OpenIn=Browser”; %> onclick=<%SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(StrOnClickItem),Response.Output);%>> <% } SPHttpUtility.HtmlEncode(StrNameItem,Response.Output); if (!string.IsNullOrEmpty(StrUrlItem)) { %> <% } %>Now once workflow status page get customized we need to change the URL of workflow status page in workflow.xml file as _layouts/{Our folder}/WrkStat.aspx

Advertisements

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