I have an expense approval process that I need to implement using InfoPath in a forms based authentication (FBA) environment using forms services (web based InfoPath).
There are two approval groups and the process works like this:
- User fills out an expense report and submits it for approval.
- That triggers an email to first level approver group.
- First level approver reviews and approves or denies the report.
- If first level person approves it, system notifies second level approver.
On the InfoPath side of things, I have different sections that hide/appear based on whether the user is a member of one of those approval groups.
In an FBA environment the username() function always returns blank, sadly. What I’ve done is set up a a custom list called “Approval Groups”.
I don’t add any additional columns to the list.
When the form opens up, it has a rule like this:
The “set a field’s value” is here:
This is basically saying: Query the approval group custom list and filter that query by looking for any row where Title’s value = “NORDIC”.
If that returns any value, then the current user is a member of that group. I know it contains that value because the string length is greater than zero.
Close the loop by securing the individual items in the Approval Group list. At run-time, if the current user doesn’t have appropriate security access to that item then the query won’t return it, string-length will be zero and now you know the current user is not part of that group. You can use that fact as needed in the form.
This is a super brief write-up. I’m pressed for time or I’d provide more detail.
I don’t know how relevant it is that I’m in an FBA environment. This would probably work well in a non-FBA environment but I can imagine cases where this would be useful.
Subscribe to my blog.
Follow me on Twitter at http://www.twitter.com/pagalvin