Manage Role Based Access in info-path forms

Hello Friends

  I have one info-path form and one view for that form. 

  1) Default

  2) Named view 

  I gave few columns for default view and some other columns for Named view . when ever we edit item it is showing both views on top ribbon. how to control  those views based on user login.

 
April 17th, 2015 5:12pm

You can simply hide the Views on the ribbon while you edit the form. Go to File tab > Form Options and uncheck View from the below option and then save/publish your form.

If you are looking for another approach without touching the above option, then in InfoPath Designer open:

- Click Data tab
- Click Form Load button
- Create a rule that switch views based on the currently login user where condition would be
CurrentUser == "Venkat Garikapati".
- You should create a field 'CurrentUser' that will control the view. This could be simple text field.
(CurrentUser would be a field that fetches the currently login user. You can implement this approach by code-behind where you will fetch the currently login user in store it in CurrentUser field).

Code-behind logic to fetch currently login user and update it on CurrentUser field:

public string currentLoginUser
        {
            get
            {
                string _user = HttpContext.Current.User.Identity.Name;
                return _user;
            }
        }

This code will fetch saMAccountName along with the domain name. You should implement a logic to discard "\\" character from the name and fetch the display name from AD.

root.SelectSingleNode("/my:SalesFields/my:txt_CurrentUser", NamespaceManager).SetValue(userName1);
Above userName1 is the final display name fetched from AD.


Free Windows Admin Tool Kit Click here and download it now
April 19th, 2015 3:31am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics