- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2025 04:48 PM - edited 03-31-2025 11:03 PM
Can anyone help me understand why this simple script is causing the info message to be displayed twice only within SOW?
I should add there is no other onChange client scripts that are associated with this field. Checking or unchecking isolated script appears to make no difference once so ever.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2025 01:46 PM
From our SOW admin:
I went and duplicated the new record page and checked the whole duplication issue after and everything seems to be working just fine now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2025 08:48 PM
Hmm that's the only thing which might cause this.
I used script from @Vishal Jaswal and it worked fine as well in SOW
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-31-2025 08:50 PM
works fine in my PDI as well and what has me wanting to pull my hair out.
This makes zero sense but for this script this seems to work:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || isTemplate) {
return;
}
// Define the field name explicitly
var fieldName = 'description'; // Replace 'your_field_name' with the actual field name
// Add a delay of 5 seconds before executing further actions
setTimeout(function() {
// Check if the field is still populated
if (g_form.getValue(fieldName)) {
return;
}
if (newValue === 'email') {
console.log('Testing');
g_form.addInfoMessage('Testing');
g_form.setValue('description', 'test');
} else {
g_form.clearMessages();
}
}, 5000); // 5000 milliseconds = 5 seconds
}
I have tried to update my script following this format but not successful thus far but leads me further into there is a loop or something causing it to run twice.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2025 09:04 PM
any other client script is setting channel and causing the script to trigger and hence show the message?
I don't think domain separation should have any say in this
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-31-2025 09:07 PM - edited 03-31-2025 11:13 PM
Why I created this script on the Channel field and not the State field as I thought that might be the issue. There is no other client script on this field that I can find. Seems to be any client script running twice within SOW only.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2025 09:34 PM
Something is causing this definitely.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader