sharepointoffice365sharepoint-onlinecsomspfield

Unable to add site column with jslink on SharePoint online with CSOM


I'm facing a weird issue today, we have a SharePoint provider hosted add-in which used to work properly for the last year and a half.
In that SPPH Add-In we use jslink on fields. When we try to add a new site column with a jslink property specified we get an unknown error back.
If we try to create the field and then update it with the jslink value, same issue.
I tried updating the CSOM to the latest version too.
Anybody facing the same issue? Any idea on the subject?
Thanks for your help!

web.Fields.AddFieldAsXml("<Field Type=\"Note\" Name=\"myfield\" StaticName=\"myfieldSN\" DisplayName=\"My FIeld\" " +
                                                       "Required=\"FALSE\" Hidden=\"FALSE\" ReadOnly=\"FALSE\" UnlimitedLengthInDocumentLibrary=\"TRUE\" " +
                                                       "ShowInDisplayForm=\"TRUE\" ShowInEditForm=\"FALSE\" ShowInListSettings=\"TRUE\" ShowInNewForm=\"FALSE\" " +
                                                       "ShowInVersionHistory=\"TRUE\" ShowInViewForms=\"TRUE\" ShowInFileDlg=\"FALSE\" " +
                                                       "Group=\"Attribute\" JSLink=\"sp.js|~sitecollection/SiteAssets/AttributeOnline/Scripts/jquery-2.1.4.min.js|~sitecollection/SiteAssets/AttributeOnline/Scripts/jslink.js 
\" />", false, AddFieldOptions.DefaultValue);
            _context.Load(field);
            _context.ExecuteQuery(); 


Solution

  • Related question : PreSaveAction is not working in SharePoint office 365 (2016)

    As stated in the documentation here jslink is not yet supported in the new experience. In order to support your customization you'd have to disable it.