Disable a List Field When Adding/Editing in 2010


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.

  1. Create a new custom list called “Secure Users”
  2. Add a Person column called “User”
  3. Change the column to display the field called “User name”
  4. Go to your primary list where you want to disable the field and click “Customize Form” on the ribbon
  5. The following steps are in InfoPath 2010
  6. Add a new data source for the Secure Users custom list
  7. Add a Form Load rule to filter the Secure Users data source on the current user
    1. Add an Action Rule to “Set a field’s value”
    2. Select the User field in the list of queryFields for the Secure Users data source
    3. Set the value to the function userName()
    4. Add another rule to query the list with the new filter
  8. Add a rule to the appropriate controls you want disabled
    1. Select the field and add a new formatting rule
    2. Set condition – Select AccountID in the Secure Users dataFields
    3. Select “Number of occurrences of AccountID” in the “Select:” dropdown
    4. Select “is equal to” and enter zero as the value
    5. Select “Disable this control”
  9. 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.

Advertisements

One Response to “Disable a List Field When Adding/Editing in 2010”

  1. Aaron Says:

    Kerry – Great solution. Works so much simpler than other solutions posted online! How would you modify this for a group setting rather than by user in the custom list. What If I wanted to add a group to the custom list?


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: