Hi
I have solved the issue with nine simple lines of code. I looked at most of the solutions on the web and none including the one from clayton is addressing how to switch Infopath 2010 browser enabled forms views based on a login user's sharePoint groups in a simple way , so I have decided to share my code so others facing the same challenges can follow:
1. Create a group in your SharePoint site, in this example I called my "Administrators"
2.Behind the Infopath 2010 form-->Developer--->Loading Event
3.Add references to a): using Microsoft.SharePoint and b) using Microsoft.SharePoint.Security
4. Add the code below to the public void FormEvents_Loading Event and give full trust to your Infopath 2010 form. Enjoy it !!!. It works like charm SPSecurity.RunWithElevatedPrivileges(delegate(){
using (SPSite mySite = new SPSite("http://yourser/SitePages/default.aspx"))
{
using (SPWeb oWeb1 = mySite.OpenWeb())
{
if (oWeb1.IsCurrentUserMemberOfGroup(oWeb1.Groups["Administrators"].ID) == true)
{e.SetDefaultView(
"ReviewersView");
}
else
{
e.SetDefaultView(
"View 1");
}
oWeb1.Close();
mySite.Close();
}
}
});
}