I define the role of "employee" using the InfoPath "User Roles" gui feature as, "User names from the form" and selecting a "EmployeeUserID" field from my main datasource in which I store the username() function the first time the form is opened, On Form Load.
I use a SOAP web service that takes EmployeeUserID as a parameter, executes a SQL stored procedure with EmployeeUserID as a parameter, and returns a bunch of fields about the employee such as their manager's name and userid and other personnel-type data. Another rule that runs after the "set employeeUserID" rule, retrieves the employee data from this web service and sets the results into a bunch of main datasource fields. This rule only runs when the employee section data is "not signed", and the employee section fields are signed just before the employee user submits the form.
The form is able to do all of this just fine. When the "employee" user is finished filling out the form, they click a button that submits the form via email to their manager's email address.
The problem comes in when the manager opens the form. I have the "manager" role defined as, "user names from the form" and selecting the "SupervisorUserID" field from my main datasource.
My problem is that the manager is not identified in a role, so they fall into a "Undefined" role I created that's the "default" role but has no definition to it. To troubleshoot this, I added the EMployeeUSerID, SupervisorUserID, and CurrentUserID fields to the form. I populate the CurrentUserID field, which is NOT within any digitally signed sections, on form load always (no conditions on that rule's execution) by just populating it via a rule with username(). The form always shows this field as empty. To troubleshoot further, in that same rule that populates the CurrentUserID field, I added an action that displays the value of a function, username(). Each time the form opens, a window pops up showing the current userid perfectly. But then, the CurrentUserID field is still empty on the form, and the role is still Undefined.
What screen shots can I email to you? (since I don't believe this forum supports inserting images directly, and I don't have a means for posting them publicly to hyperlink to)