I have a tracking list inside my sharepoint 2013. and i have a column named "payment status". now i am trying to achieve the following,:-
When a new tracking item is created , its "Payment Status" should be "New".
To achieve this i did the following:-
inside the "Payment Status" field i define it as Required and its defualt value is "New".
Then i run the following power-shell script to hide the column from the new form:-
$web = Get-SPWeb http://****/ $field = $web.Fields["Payment Status"] $field.ShowInNewForm = $false $field.update($true)
now i tried creating a new tracking item using the built-in create form and it worked well.where the users can not see the "Payment Status" field inside the create form, and the new item got the "New" status.
but the only issue is that users can create a new tracking item using the Quick Edit grid and chose any other Payment status.
now i am not sure if there is a way to disable the "Payment Status" field inside the Quick Edit only when creating a new item,, while keep the "Payment Status" field enabled when editing items. now i know that i can write a jslink which can disable a field from the Quick Edit grid , as follow:-
(function () {
var overrideContext = {};
overrideContext.Templates = overrideContext.Templates || {};
overrideContext.Templates.OnPreRender = function(ctx) {
var statusField = ctx.ListSchema.Field.filter(function(f) {
return f.Name === 'paymentstatus';
});
if (statusField.length>0) {
statusField[0].AllowGridEditing = false;
}
}But this JSLINK will always disable the field even is users try to edit the item inside the Quick Edit grid.while i want to disable the field only when creating a new item inside the quick edit grid. so can anyone adivce on this?