- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2023 05:40 PM
Can we update the current form field from the notification email script, I have a requirement to clear the value of a form field once the notification scripts are executed.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2023 06:45 AM
Hello,
I'm not sure what you mean by "current form field"? Unless you mean a field on the "current" record that the notification is all about? If so, then yes, you can. You mentioned after the notification scripts execute, then notification scripts execute as the email is being sent...so...that is why I suggested you to do it after.
If you're referring to doing it as part of the form, then you can do it in an email script such as:
var rec = new GlideRecord('table_name');
rec.addQuery('sys_id',current.sys_id.toString());
rec.query();
if (rec.next()) {
rec.setValue('field_name', 'value');
rec.update();
}
So you'd just replace the table_name with the table involved here, field_name with the appropriate field name on this record, and the value as needed in a mail script and this will update a field on the current record.
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2023 07:12 PM
Hello,
If this needs to happen 'after' the email has been sent, then you'd have to look into something like an 'after' business rule on the sys_email table to then run a GlideRecord query to that record and then clear the field(s) value.
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2023 10:10 PM
Thanks Allen! But I would like to whether is it possible to update the current form field from the notification email script.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2023 06:45 AM
Hello,
I'm not sure what you mean by "current form field"? Unless you mean a field on the "current" record that the notification is all about? If so, then yes, you can. You mentioned after the notification scripts execute, then notification scripts execute as the email is being sent...so...that is why I suggested you to do it after.
If you're referring to doing it as part of the form, then you can do it in an email script such as:
var rec = new GlideRecord('table_name');
rec.addQuery('sys_id',current.sys_id.toString());
rec.query();
if (rec.next()) {
rec.setValue('field_name', 'value');
rec.update();
}
So you'd just replace the table_name with the table involved here, field_name with the appropriate field name on this record, and the value as needed in a mail script and this will update a field on the current record.
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2023 10:20 AM
Hi @nikcr
Thanks for marking my reply as Helpful.
If my reply also helped guide you Correctly, please also mark it as "Accept Solution"
Thanks and take care! 🙂
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!