1

I am working on a project where I am retrieving the status of all running automation in the system. One of the information which I would like to display is how frequent the automation is scheduled to run. I managed to extract the automation object and recurrenceID, however, I am not able to extract the scheduledefinition of the automation.

Is there any other way to find out the recurrence setting? How do I make use of the recurrenceID?

var objectType = "Automation";

var cols = ["ProgramID", "Name", "Description", "CustomerKey", "IsActive", "CreatedDate", "Status","RecurrenceID","AutomationType","ScheduledTime","CategoryID","LastRunTime","LastSaveDate","CreatedBy","ModifiedBy","LastSavedBy","ModifiedDate"];

var filter = {
    Property: "Status",
    SimpleOperator: "equals",
    Value: "3"
};

var data = prox.retrieve(objectType, cols, filter);
2

Honestly, I am not 100% positive you would be able to get the frequency through SOAP or at least not easily. But, the REST API option can provide you this information. The only part that kinda stinks is that you have to retrieve it per object. So you would need to make a call for every automation you are looking up.

So likely your process would be to grab the ObjectIDs from your call above, then as you iterate through that returned array, you would make the below call to get the schedule. Mind you, this is an undocumented endpoint so keep that in mind if you implement. There is no official support nor requirement of consistency on it. It can disappear or change without notice.

GET /automation/v1/automations/{{autoid}}
Host: https://{{et_subdomain}}.rest.marketingcloudapis.com
Authorization: Bearer {{auth_Token}}
Content-Type: application/json

This will return a JSON that you can sift through to find the schedule.

{
    "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "name": "exampleAuto",
    "description": "",
    "key": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "typeId": 1,
    "type": "scheduled",
    "statusId": 3,
    "status": "Running",
    "categoryId": xxxxxx,
    "lastRunTime": "1020-09-11T06:18:00.747",
    "lastRunInstanceId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "schedule": {
        "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
        "typeId": 2,
        "startDate": "1020-05-10T11:18:00",
        "endDate": "3079-06-06T00:00:00",
        "scheduledTime": "1020-10-14T07:18:00",
        "rangeTypeId": 1,
        "occurrences": 517813,
        "pattern": "<Pattern><PatternType>0</PatternType><HourInterval>1</HourInterval></Pattern>",
        "icalRecur": "FREQ=HOURLY;UNTIL=20790606;INTERVAL=1",
        "timezoneName": "Central Standard Time (no DST)",
        "scheduleStatus": "active",
        "timezoneId": 1
    },
    "steps": [
        {
            "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
            "name": "",
            "step": 1,
            "activities": [
                {
                    "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
                    "name": "example_activity",
                    "activityObjectId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
                    "objectTypeId": xxx,
                    "displayOrder": x
                }
            ]
        }
    ]
}

You will see a property 'schedule' that contains an object all about the automation's schedule. You would just need to parse this and gather the required information there.

1
  • Thank you Gortonington. This automation endpoint is cool. Salesforce should add this into the supported list. Is there a undocumented endpoint for journey builder? Should include one for journey builder as well. – Yong Seng Goh Sep 16 '20 at 8:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.