I am attempting to retrieve the status of an automation in a Business Unit with the following AMPscript, but I haven't been successful yet. Could someone please assist?
%%[
SET @key = "###"
SET @mid = "###"
SET @rr = CreateObject("RetrieveRequest")
SET @clientid = CreateObject("ClientID")
SetObjectProperty(@clientid,"ID",@mid)
AddObjectArrayItem(@rr,"ClientIDs",@clientid)
SetObjectProperty(@rr,"QueryAllAccounts",1)
SetObjectProperty(@rr, "ObjectType","Automation")
AddObjectArrayItem(@rr,"Properties","ProgramID")
AddObjectArrayItem(@rr,"Properties","Name")
AddObjectArrayItem(@rr,"Properties","CustomerKey")
AddObjectArrayItem(@rr,"Properties","CreatedDate")
AddObjectArrayItem(@rr,"Properties","Description")
AddObjectArrayItem(@rr,"Properties","IsActive")
AddObjectArrayItem(@rr,"Properties","Status")
AddObjectArrayItem(@rr,"Properties","ScheduledTime")
SET @sfp = CreateObject("SimpleFilterPart")
SetObjectProperty(@sfp, "Property", "CustomerKey")
SetObjectProperty(@sfp, "SimpleOperator", "equals")
AddObjectArrayItem(@sfp, "Value", @key)
SetObjectProperty(@rr, "Filter", @sfp)
SET @automations = InvokeRetrieve(@rr)
FOR @c = 1 TO RowCount(@automations) DO
SET @row = Row(@automations ,@c)
SET @autoCustomerKey = Field(@row,"CustomerKey")
NEXT @c
]%%
CustomerKey : %%=v(@autoCustomerKey)=%%
The above code returns:
CustomerKey :
I would like to retrieve the statuses of the Automations in all Business Units to create a Landing Page dashboard. The Landing Page would be in the top level Business Unit.