current.operation() is null
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2017 08:13 AM
Hello Community,
Any reason why current.operation() would always be null in an email notification script? As I understand it, .operation() is a GlideRecord method. In the email script, current returns a GlideRecord of the current record. What am I missing here?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2017 08:16 AM
Hi Kenneth,
The most common use of current.operation() I have seen is in business rules, where the system has already triggered the insert/update/delete/read action and the business rule is reacting to it.
With inbound email actions, no insert/update has taken place yet... that's what the action is trying to determine (what to do next) so current.operation() won't return anything until the current.insert() or current.update() has been triggered.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2017 08:18 AM
This is for an email notification script for an outbound email notification. When I create an Ad Hoc Request, it generates the notification, which runs the script. The notification is triggered by using the insert checkbox on the notification record. Would the current object, then not have access to that same event being performed on the record?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2017 08:28 AM
Sorry for the misunderstanding Kenneth. I missed that detail.
You are right, I would expect current.operation() to know what's going on in an outbound email script. I don't have an answer for you on that one, but I suspect support does. I'll be interested to hear what they have to say.
HI Service Portal - ServiceNow

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2017 08:48 AM
I don't believe current.operation() works asynchronously, and since the notification would be running asynchronously, I don't think it would have access to the type of operation that triggered it. Just like you don't have access to the previous object in an async.
You might have to do something like fire an event from a business rule and then pass the operation type as a parameter.