none
How to disable User EDIT list option after submitting entries RRS feed

  • Question

  • Hi,

    I have a user suggestion form. I want, if user submit suggestions then when next time he checks the list for his entry the form should be shown to him as read only. There should be no option to delete or update that particular List entry.

    Any idea how to do this task without using asp.net coding or javascript?

    Or could it be controlled by workflows would be great?

    Any swift solution would be appreciated.

    Sunday, October 27, 2013 10:33 AM

Answers

  • Hello Ziauddin,

    you can accomplish this through modifying the actual form in InfoPath, or through a Sharepoint designer workflow.

    note: the method proposed in workflow would apply user permission on the whole List Item, while the Infopath mothod makes only specific fields Read-Only (could make the whole form also) but wont change List Item permission.

    in Infopath:

    • first, create a new field and call it for example "Redirect"
    • you have a default view for your form, where your users are filling the form through with full write permission
    • create a new view call it for example "Read-Only-View" (managed through Page Design> views)
    • "Ctrl+A" select everything on your default view and copy it
    • go to the newly created view, select all "Ctrl+A" > paste
    • right click a form field you wish would be read-only after form is submitted> click on properties > navigate display tab > tick the Read-Only check box.
    • repeat the above step for all fields required to be read only after submit.
    • create a action rule on your submit button> action> set a field's value. and choose the field "Redirect" you already created in the first step, and in the Value type "Yes"
    • create the following "Form load" action rule,  (click on data from the ribbon> Form Load):
    • Condition: If Redirect field = "Yes"   >  choose the action "Switch View" and choose the view you created earlier "Read-Only-View"

    save and publish your form.

    now whenever the user submitted the form, the next time they open their entry, they'll have the read-only view.

    in Sharepoint designer workflow:

    if you have a workflow associated to this list (or just create one!)

    • Edit the workflow
    • put your cursor above the first step in your workflow
    • from the ribbon, in the insert group choose "Impersonation step"
    • place your cursor in the Impersonation step and click on Actions from the ribbon
    • find and choose the "Replace List Item Permission" from the "List Actions" section
    • click on the "these permissions" and replace the permissions as you desire (read-only, etc)
    • click the "this list" and choose "Current Item"

    save and publish your workflow

    this way whenever the user submitted the list item and the workflow starts, it replaces their permissions they way you configured.

    hope this helps

    let us know how it goes


    Aabed - If a reply helps you Vote As Helpful, if a reply solves your problem don't forget to Mark As Answer.


    Monday, October 28, 2013 3:36 PM
  • in your original post you mentioned

    " I want, if user submit suggestions then when next time he checks the list for his entry the form should be shown to him as read only. There should be no option to delete or update that particular List entry."

    ....so on the target list, "break permission inheritance...."...let administrator have fill control.....for all other users or limited number of users...change permissions by assigning "custom level" created which has "Add Item" access.....

    may you please elaborate challenges you would foresee, when you feel  that it is not possible to assign Custom level access to everyone (anyone...users could be anyone....)...whatever access "anyone" has, edit it and give them custom access, ONLY on this list, as you dont want them to do anything other that Adding Items.


    Naveed.DG MCITP, MCTS -SharePoint 2010 Administrator "Vote As Helpful" If it helps!!

    Saturday, November 2, 2013 7:20 AM

All replies

  • You need custom activity to change item activity to readonly:

    It is better to create folders for each permission role and route item to it when you add using workflow.

    Code Here contains list of custom activity:
    http://spdactivities.codeplex.com/


    Tarek Yehia

    Sunday, October 27, 2013 11:52 AM
  • thanks Tarek for reply but in the provided link I didn't see any custom activity solution.

    Anyways, I have already created user groups for different groups to evaluate user input.

    Could you please help me out to user in workflow conditions how to disable or enable entry form when user completes and submits his input?

    Sunday, October 27, 2013 2:58 PM
  • Once the item is saved may be you can run a workflow to break permissions and make  the item read only for the user.

    Hope it helps!

    Sunday, October 27, 2013 5:40 PM
  • Hi,

    Create a folder on the SharePoint list then store all list items within the folder. Set the permissions on the folder as 'unique' and create a 'Read-Only' group for the folder, then add all required user accounts to the group.

    If necessary, you could attach a workflow to the list that copies submitted list items into the folder.

    Hope this helps.

    Kevin

    Sunday, October 27, 2013 5:47 PM
  • Once the item is saved may be you can run a workflow to break permissions and make  the item read only for the user.

    Hope it helps!

    thanks for reply jenasas.

    How to set permission for the whole form to make read only?

    Any coding example for workflow?

    Monday, October 28, 2013 4:23 AM
  • Hello Ziauddin,

    you can accomplish this through modifying the actual form in InfoPath, or through a Sharepoint designer workflow.

    note: the method proposed in workflow would apply user permission on the whole List Item, while the Infopath mothod makes only specific fields Read-Only (could make the whole form also) but wont change List Item permission.

    in Infopath:

    • first, create a new field and call it for example "Redirect"
    • you have a default view for your form, where your users are filling the form through with full write permission
    • create a new view call it for example "Read-Only-View" (managed through Page Design> views)
    • "Ctrl+A" select everything on your default view and copy it
    • go to the newly created view, select all "Ctrl+A" > paste
    • right click a form field you wish would be read-only after form is submitted> click on properties > navigate display tab > tick the Read-Only check box.
    • repeat the above step for all fields required to be read only after submit.
    • create a action rule on your submit button> action> set a field's value. and choose the field "Redirect" you already created in the first step, and in the Value type "Yes"
    • create the following "Form load" action rule,  (click on data from the ribbon> Form Load):
    • Condition: If Redirect field = "Yes"   >  choose the action "Switch View" and choose the view you created earlier "Read-Only-View"

    save and publish your form.

    now whenever the user submitted the form, the next time they open their entry, they'll have the read-only view.

    in Sharepoint designer workflow:

    if you have a workflow associated to this list (or just create one!)

    • Edit the workflow
    • put your cursor above the first step in your workflow
    • from the ribbon, in the insert group choose "Impersonation step"
    • place your cursor in the Impersonation step and click on Actions from the ribbon
    • find and choose the "Replace List Item Permission" from the "List Actions" section
    • click on the "these permissions" and replace the permissions as you desire (read-only, etc)
    • click the "this list" and choose "Current Item"

    save and publish your workflow

    this way whenever the user submitted the list item and the workflow starts, it replaces their permissions they way you configured.

    hope this helps

    let us know how it goes


    Aabed - If a reply helps you Vote As Helpful, if a reply solves your problem don't forget to Mark As Answer.


    Monday, October 28, 2013 3:36 PM
  • Hi,

    Code sample below, you could invoke the method when the item is submitted, modify as required:

    using Microsoft.SharePoint;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    namespace ...
    {

      class...

       public override void ItemAdded(SPItemEventProperties properties) {
       // Name of the List/Library

       if (properties.ListTitle == "FormLibrary")
        {     
          // Get the SPSite Object
         
          SPSite oSite = new SPSite("http://yoursite");       

         // Point to the top level web site within it

         SPWeb oWeb   = oSite.OpenWeb();

         // get the current list item that is created

         SPListItem oListItem = properties.ListItem;       
                        
         
     //****Section for setting item-level permissions, break role inheritance first to set different permissions for the list/library item...*****//

         oListItem.BreakRoleInheritance(false);

         // webroledefinitions – Read

         SPRoleDefinitionCollection webroledefinitions = oWeb.RoleDefinitions;

         // role assignment to assign read role to user or an SPGroup

         SPRoleAssignment roleassignment = new SPRoleAssignment(oWeb.CurrentUser);  
                
          //Bind and add the 'Read' role to the user

         roleassignment.RoleDefinitionBindings.Add(webroledefinitions["Read"]);

         oListItem.RoleAssignments.Add(roleassignment);

         // give read permissions to the user

         roleassignment.Update();                           
         }

        else
         {
           //Do not assign permissions to the list/library item
         }
        }

    }

    Bear in mind that by breaking item level permission on a list/library that you will have a lot of item-level permissions to manage.

    Kevin




    • Edited by kbyrne7 Monday, October 28, 2013 4:04 PM
    Monday, October 28, 2013 3:40 PM
  • Break the inheritance for list permission first then create custom permission group, like contribute without EDIT. List all site users except Site Admins &/or Owners under this group for that specific list only. Users will be allowed to add, delete but EDIT will not be allowed. 

    Hope this helps as swift solution :)

    Tuesday, October 29, 2013 5:50 PM
  • Hello,

    I assume when you say "Form" you are referring to Infopath form.

    you may find below suggestion feasible!.

    1. Create a list, List1 and have all custom fields that you have on User suggestion form.
    2. Create a custom permission level, and select Only Add Items permission level (since you don't want them to Delete and Update/edit).
    3. for all target users, assign permission on List1 using custom access level created in above step. Thus they will be able to add items and once submit, they will not be able to delete/edit/update.

    let us know if this helps you...


    Naveed.DG MCITP, MCTS -SharePoint 2010 Administrator "Vote As Helpful" If it helps!!

    Tuesday, October 29, 2013 9:22 PM
  • try creating views in infopath form . create a view which is read only and once the form is submitted switch it to read only.
    Wednesday, October 30, 2013 6:08 PM
  • Hello,

    I assume when you say "Form" you are referring to Infopath form.

    you may find below suggestion feasible!.

    1. Create a list, List1 and have all custom fields that you have on User suggestion form.
    2. Create a custom permission level, and select Only Add Items permission level (since you don't want them to Delete and Update/edit).
    3. for all target users, assign permission on List1 using custom access level created in above step. Thus they will be able to add items and once submit, they will not be able to delete/edit/update.

    let us know if this helps you...


    Naveed.DG MCITP, MCTS -SharePoint 2010 Administrator "Vote As Helpful" If it helps!!

    Dear Naveed,

    thanks for reply,

    Actually the users could be anyone so it is not possible to assign custom level permission Add, if you says that if assign custom level to a limited number of users then it is possible.

    Please advise.

    Thursday, October 31, 2013 4:33 AM
  • try creating views in infopath form . create a view which is read only and once the form is submitted switch it to read only.

    thanks jenass for your precious suggestion.

    On your this particular reply, one question also raised in my mind and I experienced that for example I have two views of one list and I opened both in infopath then shows a same form.

    I deleted some controls in the infopath form and published the form to the sharepoint list but it implemented for both views.

    Thursday, October 31, 2013 4:39 AM
  • Hello Ziauddin,

    you can accomplish this through modifying the actual form in InfoPath, or through a Sharepoint designer workflow.

    note: the method proposed in workflow would apply user permission on the whole List Item, while the Infopath mothod makes only specific fields Read-Only (could make the whole form also) but wont change List Item permission.

    in Infopath:

    • first, create a new field and call it for example "Redirect"
    • you have a default view for your form, where your users are filling the form through with full write permission
    • create a new view call it for example "Read-Only-View" (managed through Page Design> views)
    • "Ctrl+A" select everything on your default view and copy it
    • go to the newly created view, select all "Ctrl+A" > paste
    • right click a form field you wish would be read-only after form is submitted> click on properties > navigate display tab > tick the Read-Only check box.
    • repeat the above step for all fields required to be read only after submit.
    • create a action rule on your submit button> action> set a field's value. and choose the field "Redirect" you already created in the first step, and in the Value type "Yes"
    • create the following "Form load" action rule,  (click on data from the ribbon> Form Load):
    • Condition: If Redirect field = "Yes"   >  choose the action "Switch View" and choose the view you created earlier "Read-Only-View"

    save and publish your form.

    now whenever the user submitted the form, the next time they open their entry, they'll have the read-only view.

    in Sharepoint designer workflow:

    if you have a workflow associated to this list (or just create one!)

    • Edit the workflow
    • put your cursor above the first step in your workflow
    • from the ribbon, in the insert group choose "Impersonation step"
    • place your cursor in the Impersonation step and click on Actions from the ribbon
    • find and choose the "Replace List Item Permission" from the "List Actions" section
    • click on the "these permissions" and replace the permissions as you desire (read-only, etc)
    • click the "this list" and choose "Current Item"

    save and publish your workflow

    this way whenever the user submitted the list item and the workflow starts, it replaces their permissions they way you configured.

    hope this helps

    let us know how it goes


    Aabed - If a reply helps you Vote As Helpful, if a reply solves your problem don't forget to Mark As Answer.


    any chance you tried this?

    both suggested methods wont need code, and are very easy to implement.

    if you need any further assistance let me know


    Aabed - If a reply helps you Vote As Helpful, if a reply solves your problem don't forget to Mark As Answer.

    Thursday, October 31, 2013 1:50 PM
  • in your original post you mentioned

    " I want, if user submit suggestions then when next time he checks the list for his entry the form should be shown to him as read only. There should be no option to delete or update that particular List entry."

    ....so on the target list, "break permission inheritance...."...let administrator have fill control.....for all other users or limited number of users...change permissions by assigning "custom level" created which has "Add Item" access.....

    may you please elaborate challenges you would foresee, when you feel  that it is not possible to assign Custom level access to everyone (anyone...users could be anyone....)...whatever access "anyone" has, edit it and give them custom access, ONLY on this list, as you dont want them to do anything other that Adding Items.


    Naveed.DG MCITP, MCTS -SharePoint 2010 Administrator "Vote As Helpful" If it helps!!

    Saturday, November 2, 2013 7:20 AM
  • I am Using SharePoint Designer 2013 and I don't see the options you mentioned about within the workflows. Can this be done in 2013? If so, how?
    Friday, January 15, 2016 7:18 PM
  • Hey,

    I tried your method using infopath but somehow it isn't working. The problem is the fields value is changing when I click submit i.e. "Yes" but when I open the form using a link from the email, the value changes back to its original state i.e. No. And thus the form load is not working.

    Please help me solve this issue.

    Thanks


    Rishabh Jamar

    Thursday, September 5, 2019 1:31 PM