- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2022 09:46 AM
Hello SN Team,
Can you please tell me, how to identify field value of record changed using onSubmit client script.
Regards
Vinod
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2022 09:52 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2022 09:51 AM
Hi,
you should know which field to check and you can use this to check that in onSubmit
var field1 = g_form.getControl('caller_id');
if(field1.changed){
}
It's possible in business rule easily
Checking for Modified or Changed Fields in Script
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2022 10:13 AM
Here is my code, while changing the view from Cxs_popup view to default view getting error "onSubmit script error: can not read properties of undefined(reading'changed')".
function onSubmit() {
//Type appropriate comment here, and begin script below
var field1 = g_form.getControl('subcategory'); //Get the 'Caller' field control
var field2 = g_form.getControl('business_service'); //Get the 'Short description' field control
var field3 = g_form.getControl('urgency');
if (field1.changed || field2.changed ) {
return confirm("Values on the form have changed.\nDo you really want to save this record?");
}
is there any other way where we can find out which field value of the record updated.
Note :The code working in sandbox but not in dev
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2022 01:43 AM
@vinod
Did you mistakenly marked other response as correct?
The link I shared already talks about g_form.modified logic.
Would you mind marking appropriate response as correct based on timely response?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2022 09:52 AM
hey vinod ,
can you tell the exact requirement ?