I am trying to hide sections on an infopath 2010 form when users view an form, but show them when IT users view the form. I have a sharepoint 2010 list containing the IT users, with a column for the network name (jdoe for john doe) and a column with their full name (John Doe). So when the form loads, I want to check the list using the username() to determine if the sections should be hidden or visible. I have created the data connection to the list. I am using a browser form.
My plan is to use a rule in the Form Load rules to set a field, called UName, to the 'UserName' returned from the UserProfileService GetUserProfileByName. This seems to work just fine.
I am stuck there. On the UName field rules, when this field changes, I want to lookup the username in the SP list. If the name is found, I want to show the sections, but if the name is not in the list, I want to hide them.
I have a couple of questions:
1) Can I not do formatting in the Form Load rules? It is disabled in the Rule Type dropdown list?
2) What is best practices for conditionally hiding/displaying sections?
Thanks,
Lance