question

MarwaMostafa-8996 avatar image
0 Votes"
MarwaMostafa-8996 asked inderManiBhardwaj-7770 commented

How to enable/disable task list columns based on the current user - SharePoint 2016

Hello,

Our case is that we have a task list that I want to disable some fields like due date for some users and just keep it enabled for the admin user.

I previously used SharePoint Designer to create a custom edit page and set the required fields to read-only but this was using "Design" mode in SharePoint 2010 and the new form is available for all users even the admin so the fields are disabled for every one.

Recently, we have upgraded to 2016. I don't know if there is a way to make the custom edit form be available for end users while the std one for the admin or I could set the std edit form as the default again but control whether the fields are enabled or disabled based on the user.

So could you please advise how to do so. I know javascript could help in achieving this but I don't know how to apply this so could anyone please help in this.

Thank you in advance
Regards,
Marwa Mostafa

sharepoint-devoffice-sharepoint-server-developmentoffice-sharepoint-server-customization
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @MarwaMostafa-8996 ,

Would you tell me whether your issue has been resolved or have any update ?
I am looking forward to your reply.

Have a nice day!

0 Votes 0 ·

1 Answer

EchoDu-MSFT avatar image
0 Votes"
EchoDu-MSFT answered inderManiBhardwaj-7770 commented

Hello @MarwaMostafa-8996 ,

Please follow steps to Hide SharePoint List Columns based on User Permissions:

  • Place the below script in a text file, upload to the Site Assets library to store files

The Hide Field Script.txt

  • Go to the Task List, click Default New Form under the List Tab.


56513-1.png

  • On the NewForm.aspx, click Add a Web Part to add Content Editor web part

56514-2.png

  • Edit Web Part and entry the link of a text file

56515-3.png

  • Apply and Stop Editing

Thanks,
Echo Du
==========
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



1.png (25.8 KiB)
2.png (51.5 KiB)
3.png (12.6 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@EchoDu-MSFT Thanks for your response. I have a similar requirement but I only want to enable edit for selected fields in edit mode. All other fields will remain un-editable if a user belong to certain group. Can you please suggest some solution.

0 Votes 0 ·