Using a client script to edit one column in a List view after editing another

johnsgp
Mega Expert

I have a list view and would like to change one column after editing another.   For example, in an incidents view, I might want to clear the User when the User Group changes to ensure the person editing the list assigns a new user to the incident.   I have already done this in a form using g_form.setValue('column_name', '') in the onChange function, but in a list I would need to pick the selected row, I'm guessing using the table variable in the onCellEdit function?   I imagine I can write script includes or business rules but this feels like it should be quite straightforward to do.

This does not work (perhaps I'm using the wrong column_name?):

function onCellEdit(sysIDs, table, oldValues, newValue, callback) {

  g_form.setValue('column_name', '');

  callback(true);

}

1 ACCEPTED SOLUTION

johnsgp
Mega Expert

I don't think this question is likely to get a reply that directly answers the question because the documentation is not clear on the matter and it is becoming stale now.   The replies so far have either indicated alternative solutions or have hinted that it might not be possible without being definitive.   I have myself found an alternative solution to my problem but the question remains unanswered.   I will try to close it now.


View solution in original post

7 REPLIES 7

Mike Allen
Mega Sage

I think you would have to clear it on an before Business Rule, when group changes, clear assigned to.



Or you can use a quickform with a list edit UI Action and have the form pop up to prompt for a change of user:


» How to Display an Update Form in Service-now using GlideDialogWindow


Hi Mike



In my simple case, I just need to set the value to blank, so don't need a pop-up form.


johnsgp
Mega Expert

I don't think this question is likely to get a reply that directly answers the question because the documentation is not clear on the matter and it is becoming stale now.   The replies so far have either indicated alternative solutions or have hinted that it might not be possible without being definitive.   I have myself found an alternative solution to my problem but the question remains unanswered.   I will try to close it now.