Does anyone know how to get the details of the parent automation from within an SSJS script?
We are looking to develop a generic SSJS script that can be used in multiple automations, but whose behaviour is defined by which actual automation is running it.
So looking for something like the ID of the Automation, or even AutomationActivity or AutomationActivityInstance which is executing the SSJS script.
The wsProxy documentation shows examples of retrieving these objects, but you need to pass in a filter referring to a specific item rather than using a 'this' for instance. It doesn't seem that the Core and Platform libraries can help much with what I am trying to achieve.
Has anyone done anything similar?
As an example of code that does not work
var prox = new Script.Util.WSProxy();
var cols = ["ActivityID","AutomationID","Status","AutomationInstance"];
var filter = {
Property: "ActivityID",
SimpleOperator: "equals",
Value: this
};
var desc = prox.retrieve("AutomationActivityInstance", cols, filter);
This fails with
ExactTarget.OMM.InvalidFunctionParameterException: Null filter value supplied.
Clearly I can't supply 'this' as it seems to be undefined. I need a way of identifying the context under which this script activity is running.