Need for Automation Health Check:
In most of the business world, to implement a use case in the Salesforce Marketing Cloud, we need to create lots and lots of automation.
It will be very hard to keep track of which automation runs and which automation didn't run everyday.
Why Do I Need to Monitor?
Sometimes, when SFMC users try to edit an active automation directly in automation studio they would need to pause the automation. Once user made the changes, they might forget to set it to activate again.
This will have a series impact on business. I have seen people spend some hours monitoring automation as an ad-hoc activity. Now let's eliminate those!
There are a lot of blogs today, which will let you know how to pull all the automation status from Salesforce Marketing Cloud or a hard coded value of customer key appended on SSJS itself.
But the problem is, you would have created lots of automation and some you wouldn't even need. Why do you want to keep track of those?
In this blog, we are going to see how SSJS gets only the automation status which you needed to see in the Org. You can specify which automation you need to see in a data extension then run the SSJS in the org which will upserts the data into data extension with automation status. Post that you can send an email to SFMC Admins with those data extension records.
How cool is that!
Below SSJS will give you an idea of which automation has run which doesn't:
Add the SSJS in cloud page or automation Script (SSJS) activity. (view code snippet)
What does the above code do?
It is looking up all the rows in the data extension named 'Automation_Status'.
Taking each customer key one by one which is present in the same data extension.
Getting the status for each automation using the customer key and upsert in the same data extension
Pre-requisites:
Create a data extension with columns as mentioned in the screenshot. In the above case its 'Automation_Status'
Add records for which you need to monitor Automation status
Specify the automation name and customer key
Outcome:
You can check on the same data extension once the cloud page or automation activity completes.
You can see that the status and scheduled time would have added for the specified automation in data extension.
You can also use this data in data extension to send an email to specified people who need to monitor.
Below is the code to send an email notification (view code snippet) which will pull the results from the same data extension and add it into email.
Hope now you have an idea of how to implement notification on Automation Studio scheduled status :).
Please feel free to leave your feedback/comment in case of any queries.
Happy Learning!
As we have 100 of Automations running, how do we add this to the Data Extension?? Should we manually add the records and then read DE using SSJS and update with status?
Hi, Is there any way to add a field and retrieve automation last run date ?
Fantastic article! Any tips for retrieving the following from the send activity in the Automation of the automations that status were checked? - Template Name
- Audience
- Send Time
Thanks Tim for your comment. Am really glad that it helped you ! At the same we need for Triggered Sends and Journey Builder. Can you please provide?
Thanks Tim for your comment. Am really glad that it helped you !