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:
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
Post a Comment