- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2025 12:09 AM
Hi,
When a value is of a field is change on list I want to get few values from the form on the same table which then I want to pass to script include and then based on the response from script include I want to check if the value is empty in my current form and if it is empty then I want to abort them updating the field. All this action has to be done using oncelledit client script but will g_form work on cell edit client script and is this requirement feasible in cell edit client script
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2025 03:45 AM
g_form won't work in onCell edit client script
Why not do this?
1) from onCell edit pass the record sysId and see if that is empty via GlideAjax by querying and then abort, you can access the record sysId using this in onCell
function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
alert(sysIds); // this will give you record sysId, pass this via GlideAjax and then check
}
OR
2) why not use before update business rule and abort simply
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2025 03:45 AM
g_form won't work in onCell edit client script
Why not do this?
1) from onCell edit pass the record sysId and see if that is empty via GlideAjax by querying and then abort, you can access the record sysId using this in onCell
function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
alert(sysIds); // this will give you record sysId, pass this via GlideAjax and then check
}
OR
2) why not use before update business rule and abort simply
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2025 03:58 AM
Hello @MaharshiC
Since g_form is only available for form-based client scripts, you'll need to use sys_id and GlideAjax to retrieve values from other fields in the same record.
Refer my solution in this post: Is it possible to use g_form in oncell edit client scripts
Hope this helps!
"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"
Thank You
Juhi Poddar