Oncell edit client script is working in List view but not in SOW

sharmaprash
Tera Contributor

Hello Everyone
We are facing an issue in which the oncell edit client script is working in native UI but not in SOW.
We have made description field mandatory so that on list view if someone tries to save it as blank they get a message as below. But this is not being on SOW list view. I have also tried making on celledit client script UI type to all.
On some portals it was mentioned to use Data policy but that will not be feasible I think as if in future incidents come from integration or if end user send it from employee where description field isn't there so this may be an issue. so I wanted UI configuration only.
Has anyone faced such issue? Do you have any suggestion as to what we should do in this case.

4 REPLIES 4

Ankur Bawiskar
Tera Patron

@sharmaprash 

onCell edit doesn't work on SOW list

This is OOTB behavior

Why not use before insert/update BR and check if field is empty and then stop the user with record update?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Tanushree Maiti
Tera Patron

Hi @sharmaprash 

 

Make sure on your client script, 

  • UI Type is set to "All" and 
  • unchecking isolate script 

and try

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

PoonkodiS
Giga Sage

Hi @sharmaprash 

onCellEdit Client Scripts do not run in ServiceNow Workspaces (including Service Operations Workspace / SOW

Does "onCellEdit" client scripts works on workspac... - ServiceNow Communit

 

pr8172510
Tera Guru

Hi @sharmaprash, ,

I was able to achieve this requirement using a Before Update Business Rule on the Incident table instead of an onCellEdit Client Script.

Since onCellEdit Client Scripts are not supported in Service Operations Workspace (SOW), I implemented the validation on the server side:

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	if (gs.isInteractive()) {

        if (gs.nil(current.description)) {

            gs.addErrorMessage('Description is mandatory and cannot be left blank.');

            current.setAbortAction(true);
        }
    }

})(current, previous);

 

This solution is working successfully in both:

  •  Native UI List View
  •  Service Operations Workspace (SOW) List View

pr8172510_0-1781181448586.pngpr8172510_1-1781181511615.pngpr8172510_2-1781181546199.png

pr8172510_3-1781181567789.png