1

Sometimes you are faced with problems that you can not understand. Now I have a hidden column inside my Issue tracking list, which is used to store a series of string to be read by the list workflow. Now I set a default value for the column such as "ABC", and I set it as a hidden field, so user will not be able to modify its value or see it. But the problem is that if admin users change the default value of the hidden field from the "List Option>> List Setting >> Columns >> click on the hidden column", then its type inside the content type will be changed from hidden to optional and the field will appear inside the New and edit forms, so can any one advice on this please? Is there a way to prevent the hidden column from being set as optional when its default value is changed ?

I have the following problem inside my team site:

  1. I set a site column as hidden from the list content type.
  2. then I modify the column at the list level, where I changed its default value.
  3. then after that the column will be set as optional instead of hidden at the list content type.

So can anyone advice on this ? How can I remove this behavior ?

2

This is expected behavior because..

  1. You make it hidden through the content type page.
  2. Now when everything is working fine you decide to change default value of field.
  3. For this, you go to, list setting and then that particular column.
  4. If you look at the window where you change default value. we have one section "Require that this column contains information". enter image description here
  5. even if you do not touch this option, this is committed with the click of OK button. this setting is prioritized compared to content type setting.
  6. Hence it changes from Hidden to Optional and hence becomes visible.

As, for the solution, there is no configuration way for this.

Below are some workarounds.

  1. You need to use sharepoint designer and develop custom form
  2. Else educate users and ask them to make it hidden again, if they change default values.
  3. Use infopath form form input
  • I've merged the questions and answers. Thanks for the heads up! – Benny Skogberg May 29 '15 at 10:45
1

I can't answer why this is happening, but you should be able to set the column to read only or to be completely hidden from the UI using PowerShell.

$web = get-spweb -identity "SiteUrl" 
$list = $web.Lists["ListName"]

$field = $list.Fields["ColumnName"] 
$field.ReadOnly = $True 

$field.Update($true)

$web.Dispose()

ReadOnly - Optional Boolean. If TRUE, the field is not displayed in New or Edit forms but can be included in views. In addition, setting ReadOnly to TRUE hides the field from Site Settings pages for managing site columns and content types. Setting the Hidden attribute to TRUE completely hides the field from the UI. If you do not include this attribute, SharePoint Foundation treats the column as if this attribute is set to False.

If you choose to take this approach, don't forget to document what properties are changed.

Field Element

  • so what are the differences between running the script to set the column as readonly and setting it as hidden from the content type ? – john Gu May 29 '15 at 11:24
  • and i do not want to remove the column from the Site setting pages,, i need sub site admin to chnage the defualt value of the column at the list level... so seems the script you provide will remove the column from all the pages,, so how the sub site admins can change the defualt value of the column !! – john Gu May 29 '15 at 11:29
  • See the quote above, Read only allows the field to be used in listv iews, but hides it from site content types, new and edit forms ( but are available in display forms ) while Hidden hides it from the user interface completely. – Christoffer May 29 '15 at 11:29
  • Well, have the sub site owner to set the value and then run the script afterwards to set it to read only or hidden – Christoffer May 29 '15 at 11:30
  • what about this "n addition, setting ReadOnly to TRUE hides the field from Site Settings pages for managing site columns and content types." i do not want to hide it from here , i need it to be displayed as sub site admins will be assign new defualt value to it ... – john Gu May 29 '15 at 14:28
0

I was struggling with a similar issue, but using Content Types. Here my work around for that. Maybe it could be a solution for you, too. With that an admin is still able to change the default values, but on the belonging forms the fields will be hidden. Hope it helps and is not to late ...

    $web = get-spweb -identity "SiteUrl"  
    $field = $web.Fields["ColumnName"] 

    $field.ShowInEditForm = $False
    $field.ShowInNewForm = $False

    $field.Update($true)
    $web.Dispose()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.