Make all field read only

rss

Posted by Kim Jeim - May 15 ’14 at 10:35

Hi,

 

Based on a 'Status' field, I want a group of users to "lose" their Edit Rights, i.e. all the fields in the Edit Form become read only. This 'Status' field is controlled by an Admin group with Full Control so I am not worried about tracking the change of this status.

 

How do I do this without calling every single field individually? There are quite a lot of fields.

 

Many thanks in advance.

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 5 years 10 months 26 days
    #1 by Dmitry Kozlov May 16 ’14 at 02:27

    I'd recommend to use groups functionality that allows you to create completely different forms for SharePoint groups or field values (Status in your case). Please, watch the following video that demonstrates a similar case:

    http://www.youtube.com/watch?v=SBLD9hXr19o

  • Kim Jeim
    Kim Jeim
    Member
    Member for: 5 years 3 months 4 days
    #2 by Kim Jeim May 16 ’14 at 02:34

    [#1]: Hi Dmitry. Thanks for getting back to me! I would like to, but the organisation wants it so that for that particular group the permissions are as follows:

     

    1) Contribute rights if Stage = 1, and part of that permission group

    2) Read Only rights (still able to see the form), if Stage is > 2, and part of that permission group

     

    So even within that one permission group, the permissions change depend on the stage of the list item. Open to ideas on how you think this can be done elegantly. There are 8 separate groups, and they are called division in this organisation.

  • Kim Jeim
    Kim Jeim
    Member
    Member for: 5 years 3 months 4 days
    #3 by Kim Jeim May 16 ’14 at 07:20

    [#2]: Hi Dmitry, I figured out an easier way to do it. Thanks for the response. What I did was use the user-defined rule to determine if the user could get Edit Rights (quite a complicated IF statement, but a much more elegant solution than what I had in mind originally).

     

    I then made all the fields Read Only in the form that All Users get.

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 5 years 10 months 26 days
    #4 by Dmitry Kozlov May 18 ’14 at 05:39

    [#3]: Exactly! Good job, Kim.

  • Kim Jeim
    Kim Jeim
    Member
    Member for: 5 years 3 months 4 days
    #5 by Kim Jeim May 18 ’14 at 09:37

    [#4]: Hi Dmirty, I have not gotten this function to work: IsCurrentUserMemberOfGroup();

     

    For example, just as a simple case, if I set the user-defined rule to be

    IsCurrentUserMemberOfGroup('Executives'), it is seen as valid, but an Executive cannot see the special form I designed (I made sure the priority is high for this group).

     

    Am I using this function correctly? Because I need to expand this for the example I had earlier, where if you were part of 1/8 divisions (SP permission group), the line item belonged to that respective division (choice field), and the status of the item was in "Stage 1", I have a particular set of forms that allow me to edit, if not I get the All User set of forms which are read only. This is what I use as my user-defined rule (but all I get is the All Users Read only form):

     

    [Project Status] == '01-Planned - Not Approved' && (

    ([Division] == 'CRD' && IsCurrentUserMemberOfGroup('Division CRD')) ||

    ([Division] == 'DVD' && IsCurrentUserMemberOfGroup('Division DVD')) ||

    ([Division] == 'ERD' && IsCurrentUserMemberOfGroup('Division ERD')) ||

    ([Division] == 'SSD' && IsCurrentUserMemberOfGroup('Division SSD')) ||

    ([Division] == 'NS&ID' && IsCurrentUserMemberOfGroup('Division NS&ID')) ||

    ([Division] == 'MED' && IsCurrentUserMemberOfGroup('Division MED')) ||

    ([Division] == 'CSD' && IsCurrentUserMemberOfGroup('Division CSD')) ||

    ([Division] == 'DCEO' && IsCurrentUserMemberOfGroup('Division DCEO'))

    )

     

    Thanks in advance.


  • Kim Jeim
    Kim Jeim
    Member
    Member for: 5 years 3 months 4 days
    #6 by Kim Jeim May 18 ’14 at 10:24

    [#5]: Hi, just to add. I tried to print the value of IsCurrentUserMemberOfGroup('Executives') to the console, and it said the function is undefined. I found the function in one of your pages: http://spform.com/documentation/groups/functions. Not sure what I am doing wrong. I basically need to check if the user is part of that SP permission group.

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 5 years 10 months 26 days
    #7 by Dmitry Kozlov May 19 ’14 at 03:38

    [#6]: Hi Kim,

    You cannot execute this code in the browser console because it isn't JavaScript. This code is executed on the server side. For example, IsCurrentUserMemberOfGroup has the following body in C#:

    var group = Web.SiteGroups[groupName];
    return group.ContainsCurrentUser;
    

    Your code seems correct. Please, try to define less complicated rule with IsCurrentUserMemberOfGroup() only. Make sure that you don't have misprints in the name of SharePoint group and the user belongs to it. I've just tested this function in my environment. It works properly.

  • Kim Jeim
    Kim Jeim
    Member
    Member for: 5 years 3 months 4 days
    #8 by Kim Jeim May 19 ’14 at 05:22

    [#7]: Hi Dmitry,

     

    I have tried what you suggested, and just used Administrators as the group I am checking against as it is a simple out of the box SharePoint group. It still does not work. I attached a video to hopefully help: http://screencast.com/t/JjCJPcJgdJL

     

    I think (and I may be wrong), that it was working the way I expected it to last week when I replied to you saying I figured it out. That is why I am so bewildered as to why it is not working. Also, some additional information, I am using Forms Designer in a SaaS EPM Live environment.

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 5 years 10 months 26 days
    #9 by Dmitry Kozlov May 19 ’14 at 10:25

    [#8]: Please, note that the function IsCurrentUserMemberOfGroup has been implemented in version 2.8.4. If you have an earlier version, please download the latest one from our website and upgrade your current version: http://spform.com/download

Displaying 1 to 9 of 9 messages