Setvalue funcion is not working in OncellEdit Clients script,could you guys tell me how to set a value based on one condition in oncelledit client script.Thanks in Advance.

sainath3
Mega Guru

function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
var saveAndClose = true;
//Type appropriate comment here, and begin script below
if(newValue != 'abc'){


alert('allowed');

 

saveAndClose = false;


} else {

 


g_form.setValue('u_state_child','sai');
saveAndClose = true;

return;
}


callback(saveAndClose);
}

1 REPLY 1

Barbara L - Gli
Tera Guru

The thing about working in list view is the column/field values present are all server values. Unlike a form where the values exist on the client and then are submitted, these list cells are edited one at a time and only briefly exist on the client, so they wouldn't be set in the same way.

Several people in this community thread suggested using a business rule instead, or if you'd like to stick to your client script you could potentially make a GlideAjax call as suggested here. The value would have to be changed server side.

Hope this helps!