NetSuite: Saved Search Alerts When Record is Updated ONLY

Saved Searches have the capability to send email alerts when records are created or updated. But what if you only need email alerts to be sent when records are updated. To be more specific, if you want to be notified when the Sales Rep field on a customer record is updated, then you would set the relevant fields like so:


If you try this setup, you will likely see that notifications still get sent when records are created. Shouldn't adding a field on the Updated Fields tab prevent that from happening? To explain this behavior, it is likely that once the record gets created, Sales Territories takes over and updates the record and sets the Sales Rep field immediately. This would be considered an update, and therefore would trigger the email alert, at the same time as the date created. The timestamps between the update and the date created are so similar, that they appear to be the same in the system notes. This makes us believe that the email is sent on create, when in reality, the email was sent on an update. There is, in fact, a very slight difference between the two.

So how do we get around it? At first, I thought of filtering the create system note from the subtracting the timestamps from system notes. But then you, would need an aggregate function like sum or listagg to subtract the two. And you can't send update alerts on summarized results.

The next idea I had was to subtract the date created itself from the update's system note's timestamp. Essentially, when the update happens so close to the creation date (such as when sales territories take over), the system note gets flagged, getting it excluded from the search.

I would use the round function because the difference between the update's system note's timestamp, and the date created is likely not going to be an exact zero. I also wanted near-zero differences (updates happening in a fraction of a second) to be flagged and excluded from the search. Trial and error helped me identify that rounding to 4 decimal places was ideal. The formula would be as follows:

case when round({systemnotes.date}-{datecreated},4) = 0 then 1 end


So what did we learn today? Email alerts on saved searches can get sent on create, even when we intend them to get sent on update. This happens because some other feature/script/workflow updates the record after the record is saved/submitted. To get around this, exclude results whose system notes are created a fraction of a second from the date created.

Comments