I have created a site column of type Single link of text, and i hide it from the New & Edit forms (and i am only populating its value inside a workflow) using this PnP script:-
$customfield.SetShowInEditForm($false)
$Context.ExecuteQuery()
$customfield.SetShowInNewForm($false)
$Context.ExecuteQuery()
$customfield.UpdateAndPushChanges($false)
$Context.ExecuteQuery()
but still the field will be editable when using the list's Quick Edit. Now in the classic UI, i use to create JSLINK and link it with the field which will cause the filed to be in Read-Only inside the quick edit grid. here is the JSLINK i use to have:-
function () {
var overrideContext = {};
overrideContext.Templates = overrideContext.Templates || {};
overrideContext.Templates.OnPreRender = function(ctx) {
var statusField = ctx.ListSchema.Field.filter(function(f) {
return f.Name === 'ItemNumber';
});
if (statusField.length>0) {
statusField[0].AllowGridEditing = false;
}
}
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideContext);
})();
but seems this approach will not work inside the modern UI. so can anyone advice on this? Can I take benefit from the column formatting capability?