3

I'm trying to update the AutomationTasks of an automation in Marketing Cloud with the SOAP API. The docs don't indicate whether this is possible (the example SOAP envelope for updating an automation only changes the automation's name). I've given the SOAP envelope the shape I'd expect SFMC to want based on the structure of other well-formed update requests. Here is a sample SOAP request:

    <?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://exacttarget.com/wsdl/partnerAPI" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header>
        <fueloauth>TOKEN</fueloauth>
    </soapenv:Header>
    <soapenv:Body>
        <tns:UpdateRequest>
            <tns:Objects xsi:type="ns1:Automation" xmlns:ns1="http://exacttarget.com/wsdl/partnerAPI">
                <tns:ObjectID>525ca232-0e23-4462-b756-3bbe8f3ecb0e</tns:ObjectID>
                <tns:Name>new name automation</tns:Name>
                <tns:AutomationTasks>
                    <tns:AutomationTask>
                        <tns:Name>mbr-test-query-9999</tns:Name>
                        <tns:Activities>
                            <tns:Activity>
                                <tns:ObjectID>2b175ad6-452c-4e66-bdd2-7dbcd514c2a3</tns:ObjectID>
                                <tns:Name>mbr-test-query-9999 Activity</tns:Name>
                                <tns:ActivityObject xsi:type="ns1:QueryDefinition">
                                    <tns:ObjectID>OBJECT ID</tns:ObjectID>
                                    <tns:CustomerKey>mbr-test-query-9999</tns:CustomerKey>
                                    <tns:Name>mbr-test-query-9999</tns:Name>
                                </tns:ActivityObject>
                            </tns:Activity>
                        </tns:Activities>
                    </tns:AutomationTask>
                    <tns:AutomationTask>
                        <tns:Name>mbr-test-query-test</tns:Name>
                        <tns:Activities>
                            <tns:Activity>
                                <tns:Name>mbr-test-query-test Activity</tns:Name>
                                <tns:ActivityObject xsi:type="ns1:QueryDefinition">
                                    <tns:ObjectID>OBJECTID</tns:ObjectID>
                                    <tns:CustomerKey>mbr-test-query-test</tns:CustomerKey>
                                    <tns:Name>mbr-test-query-test</tns:Name>
                                </tns:ActivityObject>
                            </tns:Activity>
                        </tns:Activities>
                    </tns:AutomationTask>
                </tns:AutomationTasks>
            </tns:Objects>
        </tns:UpdateRequest>
    </soapenv:Body>
</soapenv:Envelope>

The response I'm getting looks about how you'd expect a successful response to look like, with one exception.

soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
   <soap:Header>
      <wsa:Action>UpdateResponse</wsa:Action>
      <wsa:MessageID>urn:uuid:f7bf42ad-a147-4e8a-8beb-b1847ff976c1</wsa:MessageID>
      <wsa:RelatesTo>urn:uuid:072ba5b4-e4c4-4029-9a37-d7126e0b5e00</wsa:RelatesTo>
      <wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
      <wsse:Security>
         <wsu:Timestamp wsu:Id="Timestamp-7d79a0d3-cc16-4581-a7cd-1c94417d1ae4">
            <wsu:Created>2019-03-19T15:52:52Z</wsu:Created>
            <wsu:Expires>2019-03-19T15:57:52Z</wsu:Expires>
         </wsu:Timestamp>
      </wsse:Security>
   </soap:Header>
   <soap:Body>
      <UpdateResponse xmlns="http://exacttarget.com/wsdl/partnerAPI">
         <Results>
            <StatusCode>OK</StatusCode>
            <StatusMessage>Program updated</StatusMessage>
            <OrdinalID>0</OrdinalID>
            <Object xsi:type="Automation">
               <PartnerKey xsi:nil="true"/>
               <PartnerProperties>
                  <Name>AutomationType</Name>
                  <Value>Scheduled</Value>
               </PartnerProperties>
               <ObjectID>525ca232-0e23-4462-b756-3bbe8f3ecb0e</ObjectID>
               <CustomerKey>e29ad654-1898-49d7-b714-253cd08aeee5</CustomerKey>
               <IsPlatformObject>false</IsPlatformObject>
               <Name>new name automation</Name>
               <Description/>
               <AutomationTasks>
                  <AutomationTask>
                     <PartnerKey xsi:nil="true"/>
                     <ObjectID xsi:nil="true"/>
                     <Activities>
                        <Activity>
                           <PartnerKey xsi:nil="true"/>
                           <ObjectID xsi:nil="true"/>
                           <Name>mbr-test-query-test Activity</Name>
                           <Description/>
                           <IsActive>false</IsActive>
                           <Definition>
                              <PartnerKey xsi:nil="true"/>
                              <ObjectID xsi:nil="true"/>
                           </Definition>
                           <Sequence>0</Sequence>
                        </Activity>
                     </Activities>
                  </AutomationTask>
                  <AutomationTask>
                     <PartnerKey xsi:nil="true"/>
                     <ObjectID xsi:nil="true"/>
                     <Activities>
                        <Activity>
                           <PartnerKey xsi:nil="true"/>
                           <ObjectID xsi:nil="true"/>
                           <Name>mbr-test-query-test Activity</Name>
                           <Description/>
                           <IsActive>false</IsActive>
                           <Definition>
                              <PartnerKey xsi:nil="true"/>
                              <ObjectID xsi:nil="true"/>
                           </Definition>
                           <Sequence>0</Sequence>
                        </Activity>
                     </Activities>
                  </AutomationTask>
               </AutomationTasks>
               <IsActive>true</IsActive>
               <AutomationType>Scheduled</AutomationType>
            </Object>
         </Results>
         <RequestID>50e4bad7-2ec0-4832-8aa7-9ba428a5e2d7</RequestID>
         <OverallStatus>OK</OverallStatus>
      </UpdateResponse>
   </soap:Body>
</soap:Envelope>

Notice that instead of listing the two automation tasks I sent, one of my tasks is repeated twice. More importantly, the update isn't being reflected in the automation. I'm not sure what the issue is. The repeated task in the response makes me wonder whether there's some internal malfunction on the marketing cloud side, or if updating automation tasks is even supported. Hopefully I'm doing something wrong in the request. Would appreciate any insight you can provide. Thanks!

Your Answer

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

Browse other questions tagged or ask your own question.