Conditional Formatting, Hide section if user is not in SharePoint list. - InfoPath Dev
in

InfoPath Dev

Conditional Formatting, Hide section if user is not in SharePoint list.

Last post 07-22-2013 05:53 AM by Jimmy. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 07-16-2012 07:32 AM

    Conditional Formatting, Hide section if user is not in SharePoint list.

    I need some help with conditional formatting.  I am trying to hide a section from view if you are not a in a SharePoint list.  IP 2010, SP 2010

    I have two columns in the SharePoint list.  A text field for User Name and a “Person or Group” selector.

    SharePoint list example:

    Text Field, “Person or Group”

    Jon Smith, domain\jsmith

    Sara Smith, domain\ssmith

    How do I hide a section if they are not in that SharePoint group?

  • 07-16-2012 07:43 AM In reply to

    Re: Conditional Formatting, Hide section if user is not in SharePoint list.

    You'll need to create a secondary data connection to the SharePoint list in your form.  Retrieve the current user name using the userName function.  With these pieces of data, you can now create a formatting rule on your section that will hide conditionally based on whether the user name exists in that list.  Hope that guides you in the right direction.
    Anson Hidajat
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™

  • 07-17-2013 01:09 PM In reply to

    • Frenzy
    • Not Ranked
    • Joined on 01-31-2011
    • Posts 1

    Re: Conditional Formatting, Hide section if user is not in SharePoint list.

     I'm having strange issues using the above example to do the same thing.  Specifically, my form has an area (i.e. "Section") that I wish only certain people (based on a SharePoint List of usernames) to see when they access the form.

     My rule's condition is:  AuthUsername [is not equal to] userName()

    I have a field named 'username' that contains the value 'userName()' and I have also ensured that I have a secondary data connection that points to the SharePoint List that contains the list of usernames which are authorized to view that Section of the form.  I also ensured that the secondary data connection has only the 'AuthUsername' checkbox checked.I did not check the checkbox for 'Store a copy of the data in the form template as I do not believe I need to do this.  I also ensured that the checkbox to 'automatically retrieve the data from the form when the form is opened' is checked so that the variable is available for the rule to work.

    When I go to the form and either edit or create a new item I cannot see that hidden section of the form that I should be able to view.  My username within the SharePoint List that the secondary data connection retrieves has only the username but NOT the domain name (i.e. mjohn) but maybe I should include the domain name too? (i.e. DOMAIN\mjohn)?  

     Any help would be greatly appreciated.  Funny thing is...I've done this in the past, many many times, successfully.  That was a different job and a few years ago.  I'm in a new work environment and I have no idea why it won't work now.  err...

     Phil

     

     

  • 07-22-2013 05:53 AM In reply to

    Re: Conditional Formatting, Hide section if user is not in SharePoint list.

    AuthUsername [is not equal to] userName() will evaluate to true if any of the AuthUsername values are not equal to userName(). What you should use is:

     All instances of AuthUsername are not equal to userName()

     The all instances of option should be available in a dropdown when you use the Select field or group dialog to select AuthUsername.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.