SharePoint 2010 now uses InfoPath 2010 forms for adding and editing list items. You can customize these forms to meet your needs which includes changing the order of the fields, removing fields and hiding fields for certain users. In this example I’ll show you how to disable a field if the user is not added to a custom security list. This allows you to control who has ability to maintain the data in a specific field.
- Create a new custom list called “Secure Users”
- Add a Person column called “User”
- Change the column to display the field called “User name”
- Go to your primary list where you want to disable the field and click “Customize Form” on the ribbon
- The following steps are in InfoPath 2010
- Add a new data source for the Secure Users custom list
- Add a Form Load rule to filter the Secure Users data source on the current user
- Add an Action Rule to “Set a field’s value”
- Select the User field in the list of queryFields for the Secure Users data source
- Set the value to the function userName()
- Add another rule to query the list with the new filter
- Add a rule to the appropriate controls you want disabled
- Select the field and add a new formatting rule
- Set condition – Select AccountID in the Secure Users dataFields
- Select “Number of occurrences of AccountID” in the “Select:” dropdown
- Select “is equal to” and enter zero as the value
- Select “Disable this control”
- Quick Publish the form and you’re done!
You’ve created a form that checks the Secure Users list for the current logged in user. If the user is not in the list the selected field will be disabled.