please provide me below code in clientscript runnable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2025 06:08 AM
(function executeRule(g_form, g_user, g_scratchpad) {
var oldValue = g_form.getOldValue('state');
g_form.showFieldMsg('state', 'Previous state was: ' + oldValue, 'info');
})(g_form, g_user, g_scratchpad);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2025 06:22 AM
Hi @TanujB ,
oldValue? looks like an onChange Client script
select you tableName and field if it's on table level
select catalog name and variable name if on catalog form level
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
g_form.showFieldMsg('state', 'Previous state was: ' + oldValue, 'info');
}
please share your requirement in details (with some screenshots)
if the above doesn't work
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2025 06:25 AM
Hello @TanujB ,
What is your exact requirement? Please provide some more info like you are using it on item level or any table level like INC so that we can have some info for building the script....
Below code you can use for inclident table....
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Type appropriate comment here, and begin script below
g_form.showFieldMsg('state', 'Previous state was: ' + oldValue, 'info');
}
🔹 Please mark ✅ Correct if this solves your query, and 👍 Helpful if you found the response valuable.
Best regards,
Aniket Chavan
🏆 ServiceNow MVP 2025 | 🌟 ServiceNow Rising Star 2024
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2025 06:44 AM
what's your business requirement?
Unless you start the development from your side you won't learn it.
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