0

when scheduling a "One Shot" email, we have to choose the data extensions that will be used as Target Send and The Exclusions Datas if need.

Is there a way to retrieve the data extension of that Send from that JOBID?

The send still has not been executed in this case.

And is not a Trigger Send or a Journey, is a Scheduled User Interface from Email Studio, the ones you can see in Email Studio--> Tracking --> Send --> MyTracking

Thank you.

enter image description here

1 Answer 1

1

So, it is not something simple you can do via JobID - but if you have the name or customerkey you can. You would need to utilize the SOAP API for this.

You would need to access the EmailSendDefinition object and the DataExtension object.

You would use a retrieve on EmailSendDefinition to be able to access the CustomObjectID (the internal unique identifier of the DE) and then use that to then retrieve the name/key from the DataExtension object via a filter.

So something like:

SOAP Envelope for EmailSendDefinition:

<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <s:Header>
        <a:Action s:mustUnderstand="1">Retrieve</a:Action>
        <a:To s:mustUnderstand="1">https://{{et_subdomain}}.soap.marketingcloudapis.com/Service.asmx</a:To>
        <fueloauth xmlns="http://exacttarget.com">{{dne_etAccessToken}}</fueloauth>
    </s:Header>
    <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
         <RetrieveRequest>
            <ObjectType>EmailSendDefinition</ObjectType>
            <Properties>ObjectID</Properties>
            <Properties>Name</Properties>
            <Properties>SendDefinitionList</Properties>
            <Filter xsi:type="SimpleFilterPart">
               <Property>CustomerKey</Property>
               <SimpleOperator>equals</SimpleOperator>
               <Value>{{myEmailSendDefinitionCustomerKey}}</Value>
            </Filter>
         </RetrieveRequest>
      </RetrieveRequestMsg>
    </s:Body>
</s:Envelope>

and then you would take the CustomObjectID property from the SendDefinitionList section and then use that in the following example of a Retrieve on the DataExtension object:

<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <s:Header>
        <a:Action s:mustUnderstand="1">Retrieve</a:Action>
        <a:To s:mustUnderstand="1">https://{{et_subdomain}}.soap.marketingcloudapis.com/Service.asmx</a:To>
        <fueloauth xmlns="http://exacttarget.com">{{dne_etAccessToken}}</fueloauth>
    </s:Header>
    <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
            <RetrieveRequest>
                <ObjectType>DataExtension</ObjectType>
                <Properties>ObjectID</Properties>
                <Properties>CustomerKey</Properties>
                <Properties>Name</Properties>
                <Properties>IsSendable</Properties>
                <Properties>SendableSubscriberField.Name</Properties>
                <Filter xsi:type="SimpleFilterPart">
                    <Property>ObjectID</Property>
                    <SimpleOperator>equals</SimpleOperator>
                    <Value>{{CustomObjectID}}</Value>
                </Filter>
            </RetrieveRequest>
        </RetrieveRequestMsg>
    </s:Body>
</s:Envelope>

Now if you only have the JobID and do not know the Name or Customerkey of the Email Send Definition, then there is an option for you to get it. You would need to use the Send object to get the customerkey. See below example envelope to accomplish this:

<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <s:Header>
        <a:Action s:mustUnderstand="1">Retrieve</a:Action>
        <a:To s:mustUnderstand="1">https://{{et_subdomain}}.soap.marketingcloudapis.com/Service.asmx</a:To>
        <fueloauth xmlns="http://exacttarget.com">{{dne_etAccessToken}}</fueloauth>
    </s:Header>
    <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
            <RetrieveRequest>
                <ObjectType>Send</ObjectType>
                <Properties>ID</Properties>
                <Properties>EmailSendDefinition.CustomerKey</Properties>
                <Filter xsi:type="SimpleFilterPart">
                    <Property>ID</Property>
                    <SimpleOperator>equals</SimpleOperator>
                    <Value>{{JobID}}</Value>
                </Filter>
            </RetrieveRequest>
        </RetrieveRequestMsg>
    </s:Body>
</s:Envelope>

You then take the CustomerKey returned and run through the above steps to get the DE that would be sent to.

4
  • Hi, could you doublecheck the second bit? If that works it would help me solve something, but when I try it with <Properties>EmailSendDefinition.CustomerKey</Properties> that gets accepted, as in, returns a response. Yet that response contains no trace of the send definition's customer key. other stuff like ID, Subject, EmailName etc. off the Send object work just fine. also tried it with EmailSendDefinition.ObjectID but no success. Thanks! May 20 at 14:38
  • It is only for those that use EmailSendDefinitions, if it is sent via the Send Wizard, etc. then it will be empty. May 20 at 15:21
  • got it, thanks! May 20 at 16:16
  • @Gortonington, it is very helpfull to understand that for the "Send Wizard" it will be empty. Thank you.
    – AlfonsoGT
    May 21 at 10:08

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.