Why is OnComplete a better place than OnBefore for sending overall transform summary emails?

neerajydv11
Tera Contributor

Hi Everyone,

I wanted to understand why OnComplete is considered a better place than OnBefore for sending overall transform summary emails in ServiceNow.

  • What is the difference between OnBefore and OnComplete in the context of transform scripts?
  • Why is OnComplete preferred for sending summary or aggregated information?
  • What issues can occur if such emails are triggered from OnBefore instead?

It would be really helpful if someone could explain this with a real production example.

Thanks in advance!

1 REPLY 1

Vijaya_Mnpram
Kilo Sage

@neerajydv11  This very obvious. Summary makes more sense after the transformation is completed as after completing the transformation we know exactly what are updated/inserted/ignored.

On Before, we just have the un-transformed data. That data might get updated or ignored. 

 

To give you a simulation, OnBefore is like how many people registered for an event. But we will not sure how many would show up. OnComplete is like giving a report after the event is finished with exact details like 'How many showed up and what was the status of the event'.