Not sure if this goes under code or controls.
Here's the situation I need to disable certain controls on my for based on user that is logged on to the PC. So in my for load event I have some code that gets the users AccountName and puts it in a textbox:
XPathNavigator root = this.MainDataSource.CreateNavigator();
GetUserInfoWS.UserProfileService profileService = new sustainabilityForm.GetUserInfoWS.UserProfileService();
profileService.UseDefaultCredentials = true;
GetUserInfoWS.PropertyData[] userProps = null;
try
{
userProps = profileService.GetUserProfileByName(null);
}
catch { }
if (userProps == null || userProps.Length == 0) return;
GetUserInfoWS.ValueData[] values = userProps[1].Values;
XPathNavigator node = null;
node = root.SelectSingleNode("/my:myFields/my:MyCurrentUser", NamespaceManager);
node.SetValue(values[0].Value.ToString());
Then on the controls that need to be disabled I have a conditional condition that compares what I have in the textbox with what is in a custom list I created called SustainApprovers...like this:
MyCurrentUser is not equal to translate(eval(eval(SustainApprovers, "@Person"), ".."), "abcdefghijklmnopqrstuvwyxz", "ABCDEFGHIJKLMNOPQRSTUVWYXZ")
Okay so here is the problem. If I have the second part of the condition as translate(my:myFields/my:dataFields/my:Person, "abcdefghijklmnopqrstuvwyxz", "ABCDEFGHIJKLMNOPQRSTUVWYXZ") It does not go through the the custom list and query each row, it only looks at the top row....so I added in the double eval and while this gets the whole list it still does not equal true. Is there a better way to security trim controls in InfoPath?
Thanks
Tom