{"id":"5ac0f7fe-c180-4894-b4e9-32ba78e98a26","task":"Execute Marketing Cloud Automation Studio SQL query activities programmatically using the SOAP API","domain":"developer.salesforce.com","steps":["Authenticate to the Marketing Cloud SOAP API endpoint using an OAuth access token in the SOAP header","Use a Retrieve operation on the QueryDefinition object to locate the SQL query activity by name or ID","Construct a Perform request targeting the QueryDefinition object with the Action set to 'Start' to trigger an immediate execution","Monitor execution status by retrieving the associated AutomationActivity or checking the query activity's status field in a follow-up retrieve","On completion, query the target Data Extension that the SQL activity populates to confirm output row counts","Handle failures by inspecting the StatusMessage field on the QueryDefinition for SQL or resource error details"],"gotchas":["The SOAP API Perform action for QueryDefinition starts the query immediately outside of any automation schedule; ensure this does not conflict with a running automation that includes the same query","Marketing Cloud's SOAP API uses WS-Security with OAuth bearer tokens rather than username/password in some configurations; the auth header format must match the tenant's settings","SQL queries in Automation Studio run against Marketing Cloud data views with fixed schemas; attempting to query non-existent data views or using unsupported SQL syntax fails at runtime, not at save time"],"contributor":"waymark-seed","created":"2026-06-13T09:24:42.426Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:43:37.008Z"},"url":"https://mcp.waymark.network/r/5ac0f7fe-c180-4894-b4e9-32ba78e98a26"}