User roles not being recognized - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

User roles not being recognized

Last post 12-12-2013 08:33 AM by Hilary Stoupa. 10 replies.
Page 1 of 1 (11 items)
Sort Posts: Previous Next
  • 05-29-2012 11:26 AM

    • Doreen
    • Top 50 Contributor
      Female
    • Joined on 08-11-2010
    • Federal Way, WA
    • Posts 290

    User roles not being recognized

    I am using IP 2007.  I thought I had user roles working perfectly but for some reason, since last week, when an existing form opens, only the default/initiator role is recognized. I have 6 user roles set up, the "Anyone" role = All Employees is set as default and initiator. 5 other special roles are set in the form when it is created (i.e. Approver 1, Approver 2, Approver 3, Manager, and Check Processor).  Basically I have several views 1) a set of editable views viewable by the 5 special roles and 2) a set of read-only views that can viewed by Anyone.

    My understanding is the initiator role only kicks in when a new form is created. So in my case, any employee can create a form, so the "Anyone" role would be appropriate as initiator.  My understanding is the default role will be used when the form cannot ascertain which role the current user is if any. 

    My Rules form open behavior sets the forms status first, then identitifes if current users role = a special role.  Here's an example of the rule if the form is in "Awaiting Approval" (AA) status and the user is the 1st approver:

         If current users role = approver 1 and approval level = AA then switch to editable approval view

         If current users role != approver 1 and approval level = AA then switch to read-only approval view 

         The check box to "Stop processing rules when this rule finishes" is checked.

    I have similar rules for each "special" role at each "approval level".

    The problem is that no matter who opens the form, only the default role "Anyone" is recognized and the view belonging to this role is opened. The tricky part is that any of the special roles I have set up (5 of them) can also be a member of the "Anyone" role, so I think my rules are confused about who is who.

    I have tried setting the rule as: if current user = approver 1 and current user = anyone  and approval level = AA but that doesn't seem to make a difference.

    Any suggestions?

      

  • 06-01-2012 02:44 PM In reply to

    Re: User roles not being recognized

    Hi, Doreen:

    Just wanted to note here what you mentioned in email - that you've got this sorted out by applying the "anyone" role last. For future reference, here's an Office Online article I use when I need to get these squared away. It states:

     Note If the user is a member of several groups and you are assigning user roles that are based on a group, InfoPath checks the member list of each group in the order that the group is listed in the Manage User Roles dialog box. For example, if the user is a member of both the receiving agent group and the administrator group, and the administrator group is listed before the receiving agent group, the user will be assigned the user role for the administrator group.

    Hilary Stoupa

  • 12-10-2013 06:46 AM In reply to

    Re: User roles not being recognized

    Hi Hilary:

    First, thank you for the many responses you've posted to others in this site as your answers have many times over helped me resolve my InfoPath challenges. I'm having a devilish time with an InfoPath 2007 form we use to report business expenses and hope you will consider sharing your expertise with someone who is new to InfoPath & SharePoint.

    First some background: when an employee wishes to create a new expense report, they navigate to a (MOSS) SharePoint site on our corporate intranet and click a link to create a new report.  The link then opens a blank instance of the InfoPath form. The user completes the form and clicks a submit button which fires rules that uploads the form into a document library of the SharePoint site.  Like Doreen's case above our form also uses different views.  Based upon which user is opening the form from the SharePoint site (document) library determines which view they see. 

    In the form I've defined user roles (e.g. Tools -> User Roles) and have also defined form open rules (e.g. Tools -> Form Options -> Open and Save category / Open behavior section {Rules} button).  Together these have successfully worked.  However, there are some users who simultaneously exist in two different roles.  As a result, when the form opens they do not always see the view they should as defined in the form open rules.  

    The first role group I created within the form is named "Officers".  The members of this group are defined by the "User names" option of the Modify User Role dialog box (ex. CompanyDomain\A12345).  The purpose of this role was to help ensure that the form opens to a particular view for those who are members of the "Officers" group. 

    The second role group consists of users defined in a SharePoint list and are categorized as "Manager".  This list acts as a data source to a (name picker) drop-down field on the form.  (For example, when the user is completing their expense report, they click on the name drop-down to select their approving manager.  Furthermore, this list contains some of the same members from the "Officers" group because in some cases the "Officer" is also an approver and thus their name must show in the drop-down.)  In the form's open rules, those in this "Manager" group will see a different view.  However, for those who exist in both groups, it seems the form is ignoring those defined in "Officer" group and instead treats them as the lesser "Manager" role - thus showing another view they shouldn't see.  If I remove the Officer from the Manager group, then the form will open and display the correct view.  In essence the Manager view is taking precedence as it appears InfoPath gives higher priority to SharePoint list membership versus the role defined within the form itself. 

    Based on your explanation to Doreen above, do I need to define the Officer group in the form under the "Group name" section instead of "User names" option? And if so, do I keep that SharePoint list of "Managers", including the duplicate officers, so that the names continue to appear on that drop-down name picker?

    Hope this well explains the situation.  Thanks in advance for your help!

    -Joe

  • 12-10-2013 07:10 AM In reply to

    Re: User roles not being recognized

     I always end up using some trial and error on these things myself - what order are your roles in if you open the User Roles dialog?

    Hilary Stoupa

  • 12-10-2013 08:42 AM In reply to

    Re: User roles not being recognized

    Thanks for the quick response.  The order is:

    1. Officers
    2. Submitters (is default user group; NOT set as initiator; source is "Group names" as taken from our corporate domain)
    3. Managers
  • 12-10-2013 03:15 PM In reply to

    Re: User roles not being recognized

     That looks right, and it seems from reviewing the article I linked to above that it should work. InfoPath usually displays the user's role in a lower corner of the window (I forget which) - have you verified that when Officers are getting assigned to Manager it displays them in that role (just ruling out any view switching logic issues...)

    Hilary Stoupa

  • 12-10-2013 03:25 PM In reply to

    Re: User roles not being recognized

     And your Managers user role - that is from a form field?

    I wonder - the article linked above says:

    If you have assigned roles to users that are based on any combination of user names, groups, or values from a field, when a user opens a form that is based on your form template, InfoPath determines the role to assign to that user by using the following order:

    • The user's name is a value of a field in the form template.
    • The user's name is in Active Directory.
    • The user is a member of an Active Directory group.

     Note   If the user is a member of several groups and you are assigning user roles that are based on a group, InfoPath checks the member list of each group in the order that the group is listed in the Manage User Roles dialog box. For example, if the user is a member of both the receiving agent group and the administrator group, and the administrator group is listed before the receiving agent group, the user will be assigned the user role for the administrator group.

    • If none of the above are true, the default role is used. 

     Now - my assumption would be that it would do this one role at a time, but I think that is actually not the case. If Manager is in a form field, I'm wondering if it is being evaluated first. You could try (temporarily) adding a form field with the user name of your Officer and change the group to use that, then test.

     

    Hilary Stoupa

  • 12-10-2013 04:37 PM In reply to

    • Doreen
    • Top 50 Contributor
      Female
    • Joined on 08-11-2010
    • Federal Way, WA
    • Posts 290

    Re: User roles not being recognized

    If you follow Hilary's idea then you can compare curent user to role 1 and role 2 and if contained in both then decide which view to switch to.  But don't forget to clear the current user value when the user is done submitting the form.

  • 12-11-2013 04:14 AM In reply to

    Re: User roles not being recognized

    Hi Hilary & Doreen:  

    To continue following up to your follow up question if the Managers user role comes from a form field: Yes, it does.  After carefully rereading your quoted guidelines as to order of role evaluation, indeed I do agree that the form field value is taking precedence.  (At least in that regard I'm not going crazy! :) )

    I do understand your suggestion of adding a form field with the user name of the Officer and changing the group to use that, then test. Let me try that trick - having a feeling that's going to bring me closer to my solution.

     Thank you both, very much!

     

  • 12-12-2013 07:52 AM In reply to

    Re: User roles not being recognized

    Hi Hilary & Doreen:

    Great news! Got things to work as should.  The key was understanding InfoPath's order of determining a user's role.  As the value of a field in a form template takes top precedence, that's the route I followed.  So as to possibly help others and for the record, here's specifically how it was handled:

    1. Seeing I already had a SharePoint list of Managers which is used as a data source to the name picker drop-down field on the form, a new SharePoint list was created in the same fashion.  This list consists only of Officers. 
    2. Once the list was created, it was populated with the members of the Officers group.  (For those cases where some officers also need to exist in the manager's list, they were kept there as well.  That's important for step 5 later.) 
    3. Turning to the InfoPath form, I made a new data connection to my Officers SharePoint list with a specific reference to the user ID column of that list. (This reflects the same configuration used for my manager SharePoint list.) The reference is used to compare the current user's logged on ID (via the userName() function) against the SharePoint's list.
    4. After the data connection was established, a new user role was created in the form called Officers.  Its data source is the new Officers SharePoint list. Lastly, the new Officers role was then moved to the top of the user roles dialog box.
    5. Finally, in the form open options, the first rule created has the following conditions: {User's current role is equal to "Officer" and user's curent role is equal to "Manager" OR user's current role is equal to "Officer" and user's current role is NOT equal to "Manager"}.  The ensuing action was then to show the desired view.

    Understanding this now lets me take a more elegant approach.  That is previously defined user roles in the form, as set to user name, can now be replaced by the creation and use of individual SharePoint lists. Then by following above numbered steps, I'll be able to create rules and conditions from which to act accordingly. Benefits to this include:

    • No longer needing to maintain the form's user list itself and republish but rather to simply update the applicable SharePoint (user group) list.
    • Greater form security because the user list does not exist in the underlying XML, thus less risk of exploit.
    • It's a code-free solution.

    So Thank You so very much for the timely assist!  I'll consider this my early Christmas gift....  :)  

  • 12-12-2013 08:33 AM In reply to

    Re: User roles not being recognized

     Thank you for taking the time to type this up - it is sure to help others! I'm so glad you have this working the way you want it to.

    Hilary Stoupa

Page 1 of 1 (11 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.