Haaron Gonzalez Rotating Header Image

InfoPath

Invoking User Profile Service when Selecting from People Picker in InfoPath

While supporting a customer on InfoPath development, he ask me how to retrieve data from a specific user using the Profile Web Service, but he want to invoke the service after selecting a user from a people picker control, problem was that the Action section in the people picker control was disable so he was asking why and how can we accomplish what he wants. I remember that I was able to implement same exact scenario a while back ago but didn’t remember how, so I did some basic research and this is what you need to do:

Step 1 – Create another field in the form of type Text (String) and make sure to set the default value equal to the people picker Account ID field, also it is critical to check the Refresh value when formula is recalculated check box control

Step 2 – Create an Action rule in the new text box control, this will get execute any time the people picker control change the continuing Account Id value

Essentially this as the actual concern, so now we are able to have a trigger action in order to query the User Profile Web Service.

Formulas to get the first and last row on a repeating table in InfoPath

You know, you wake up knowing that is going to be a wonderful day working for a customer with the software products you love. During today on-site support session, you found out that is needed to write some good old XPath formulas on an InfoPath form.

There is a repeating table with the columns necessarily to describe travel information like Departure Date, Return Date, City, you named and the requirement was to expose the initial Departure Date and the last Return Date of the entire trip, so, what do we mean with entire trip? I maybe start a trip from San Diego to Mexico City, and then another trip from Mexico City to Seattle and then from Seattle to Las Vegas. Clearly, the Departure Date and Return Date are not associated with just one row “trip” in the repeating table because I have at least more than one row for describing all the trips.

The data structure of the repeating table is:

 

 

structure

So, here are the formulas to get the first and last row on a repeating table.

../my:TravelInfo/my:TravelInformation[count(preceding-sibling::my:TravelInformation) = 0]/my:DepartureDate

../my:TravelInfo/my:TravelInformation[count(following-sibling::my:TravelInformation) = 0]/my:ReturnDate

Fortunately, the approach work as a charm. No C# code saved the day today. Pure old good XPath did it. InfoPath, you are definitely the sunshine of my love, especially now that you will be supported until 2026 baby.

 

How to create hyperlink that open InfoPath client software a.k.a InfoPath Filler

Today was my second on site visit of the year and during my visit I was requested to fix one of the most frequent issues you will find when building workflow based solutions using SharePoint Designer and InfoPath client forms.

So an email activity in the Workflow Designer has a Hyperlink that it supposed to load a InfoPath form instance when the user clicks, in this scenario, the InfoPath solution runs in InfoPath Form Filler so when the users clicks the hyperlink it should load InfoPath Filler client application.

Turns out that using Encoded Absolute URL field that has the actual URL address of the form instance inside of the <a href=””> tag is not enough and will cause user to open Internet Explorer and try to load the form with InfoPath Form Services but because the form was designed to run in InfoPath Filler an exception will happen and users will be NOT so happy.

The solution is pretty simple; we just need to change the URL we will use to invoke InfoPath Filler to load inside of the anchor tag. Also I recommend using the Hyperlink button available in the email body of the message.

Hyperlink control in Send Email

 

The URL should have the following Workflow and Current Item variables:

  • %Workflow Context:Current Site URL% will get the URL of the current site where the workflow is running
  • /layouts/FormServer.aspx is a system web page that is used by InfoPath Form Services to render the form in the browser
  • XmlLocation is a query string variable that will tell to FormServer.aspx where the form data is located and it will use to load the form in the browser. We use the Workflow variable % Workflow Context:Current Item URL% to get the XML file
  • ClientInstalled = true is another QueryString variable that will thell the FormServer.aspx page that the form should be loaded in the client software, in this case our beloved InfoPath Form Filler
  • Source query string variable is used by the FormServer.aspx page to redirect the browser to the URL we want to load when we close the form, this work on InfoPath Form Services, nothing to do to InfoPath Filler
  • DefaultOpen is another query string variable that tells formserver.aspx how to load the form

Here you can see official information about the InfoPath parameters

So the definition of the hyperlink data is:

 

String concatenation to generate URL

The result will be something like this:

http://intranet.mycompany.com/sites/IT/finance/_layouts/FormServer.aspx?XmlLocation=http://intranet.mycompany.com/sites/IT/finance/IT Project/ITP20151030200643.xml&ClientInstalled=true&Source=http://intranet.mycompany.com/sites/IT/finance&DefaultOpen=0

So remember, red text is going to be generated by SharePoint Designer Workflow Variables, Bold text is going to be hard coded in the concatenating string.

Good luck!

Discover SharePoint Web Services methods and parameters and feel nostalgic about it

This is not the first time that a customer has an issue with SharePoint Web Services “. asmx” and InfoPath Forms that I need to quickly spot and fix. Of course SharePoint Web Services work as a charm, but sometimes the problem comes more to InfoPath forms how they consume the services SOAP response and request headers. Yes, I’ve said InfoPath. A lot of customers still work and use InfoPath forms, they created and automated HR or IT process using these wonderful technologies and we, support engineers need to support. A lot of customers still have a dependency on InfoPath.

Today I want to share a resource that is not the first time that help me identify the problem and that is .NET Web Service Studio, this application is a .NET client application that you can use to discover the Methods of a web service and review the SOAP request and response parameter.

Very handy to start understanding a web service. So because this is like the third time I’ve used these tools to start supporting an InfoPath Form here you have it:

Just go to WebServiceStudio a codeplex, hit Download and enjoy the ride. There is some nostalgic feeling working and using the tool.

Just look the icons, don't you feel little nostalgia?

Just look the icons, don’t you feel little nostalgia?

Administrator-approved form template, what really happen?

I receive a question around Administrator-approved InfoPath form templates. Here is the answer.

Q. Haaron, what really happen when we upload a new version of an InfoPath form in central admin?

A. When you upload an InfoPath form template using SharePoint Central Administration some things happen:

1. In Manage Form Template you can provision the same version of the form in more than one Site Collection, you can manage the form, activate or deactivate.

IP04

2. It creates a WSP file based on your InfoPath Form Template version and deploys as a farm solution, automatically creates a Site Collection Feature that you can Activate or Deactivate.

IP03

IP05

3. In Manage Form Templates page, when we Activate To a Site Collection basically activate a Site Collection Feature in the target Site Collection, and that provision the form in the Form Templates library.

IP06

4. Behind the scenes, when the WSP is generated SharePoint maintain a version of the form template. That make sense because forms instances can point to older version of the template

IP07

And this behavior is the same for MOSS 2007, SharePoint Server 2010 Enterprise and SharePoint Server 2013 Enterprise.

Because you can succeed, you also can fail

This is just an interesting scenario I’m dealing with.

I’m pretty sure SharePoint can support a state level solution for this problem with the proper infrastructure and procedures in place, but, are you sure the business can support a change like that? Switching from one paper form and manual process to an electronic forms with automated workflow solution requires more than servers and infrastructure, it requires business support and commitment because:

  • You need to define if current print copy approvals still going to be supported
  • The business needs to recognize and agree that electronic signing and workflow approach will be the new way to go instead of paper signing a manual processing
  • How records management and archiving will handle electronic forms if people star using this solution
  • Suddenly you the need of copy printing forms will be less

This are just some questions we need to ask if we are thinking to go to Form Management solution with SharePoint platform.