I have a site column of type "Text", and users have assign this column a default value at the list level. so now my site column contains null default value, while its child list columns are having a default value per list. now i want to apply a JSLINK to this column to hide it from quick edit grid. so I did the following steps inside our test server:-

  • i add the related javascript file to my site collection's "Style Library" folder.

  • then i run the following power-shell script to associate the site column with the related jslink:-

$web = Get-SPWeb http://vstg01
$field = $web.Fields["Customer Initials"]
$field.JSLink = "~siteCollection/Style Library/JS/HideColumnsINGrid1.js"

now the result is that the JSLINK will be applied to the site column and all its child list columns, which is fine.. but what happened is that the list columns' default value have been cleared out since the site column does not have any default value.. and seems that applying the JSLINK using powershell will override the specific list column settings..

so can i do these steps instead of the above:-

  • to associate the site column with the JSLINK , but without applying this change to any of its child list columns.

  • then to loop through all the lists and define the JSLINK at the list level for the column.

in this case any new lists will get the JSLINK associated with the column (since i have apply it to the site column) , also existing lists will have the JSLINK associated with the list column and their current default value and settings will not get overridden,

Can anyone advice on this please?


1 Answer 1


Yes, that seems like a perfectly reasonable solution.

The documentation for SPField.Update(boolean) even calls the boolean parameter pushChangesToLists. So if you pass $false, it should not update the lists, only the site column.

So, you could potentially do something like:

$web = Get-SPWeb http://vstg01
$field = $web.Fields["Customer Initials"]
$field.JSLink = "~siteCollection/Style Library/JS/HideColumnsINGrid1.js"

foreach ($list in $web.Lists)
    if ($list.Fields.ContainsField("Customer Initials"))
        $field = $list.Fields["Customer Initials"]
        $field.JSLink = "~siteCollection/Style Library/JS/HideColumnsINGrid1.js"


Note: this is untested code, you may need to change a thing or two to get it to work, but it should show the basic logical flow.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.