Re: Get deleted leads from the api

Anonymous
Not applicable

Get deleted leads from the api

I want to get a list of deleted leads from a provided date. I tried this, but it didn't worked :

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mkt="http://www.marketo.com/mktows/">
   <soapenv:Header>
<mkt:AuthenticationHeader>
...
</mkt:AuthenticationHeader>
   </soapenv:Header>
   <soapenv:Body>
      <mkt:paramsGetLeadChanges>
         <startPosition>
            <activityCreatedAt>2013-10-28T01:00:00-05:00</activityCreatedAt>
         </startPosition>
         <activityFilter>
            <includeTypes>
               <activityType>DeleteLead</activityType>
            </includeTypes>
         </activityFilter>
  </mkt:paramsGetLeadChanges>
   </soapenv:Body>
</soapenv:Envelope>

I deleted a lead to make a test, and the return count remained to 0.

Did I do something wrong?

Emmanuel
Tags (1)
4 REPLIES 4
Anonymous
Not applicable

Re: Get deleted leads from the api

The application sets a soft delete for a period of time. Those records are no longer acessible. 

Please review and vote for that idea:
http://community.marketo.com/MarketoIdeaDetail?id=08750000000HPvpAAG

Anonymous
Not applicable

Re: Get deleted leads from the api

Thanks for your answer. Do you know how right now I could know when leads are deleted?

And if my request don't works, then why does the activity type "Delete Lead" exists?

Emmanuel
Anonymous
Not applicable

Re: Get deleted leads from the api

The activity "Delete Lead" remains valid through the UI as long the leads have soft delete set to false.

The ActivityType DeleteLead defined in the WSDL is not an action; it is the action taken. If none id deleted it returns count 0.
Anonymous
Not applicable

Re: Get deleted leads from the api

Emmanuel - When Marketo is synced to a SalesForce instance and the lead from Marketo is deleted and also set to remove from SFDC (see below screenshot), you can use the "DeleteLeadFromSales" activity type and get a list of deleted leads.

0EM50000000R8Qy.jpg
 
Here is the test I ran:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:paramsGetLeadChanges xmlns:ns2="http://www.marketo.com/mktows/">
    <startPosition>
        <activityCreatedAt>2013-10-25T15:14:13.034-07:00</activityCreatedAt>
    </startPosition>
    <activityFilter>
        <includeTypes>
            <activityType>DeleteLead</activityType>
            <activityType>DeleteLeadFromSales</activityType>
        </includeTypes>
    </activityFilter>
    <batchSize>100</batchSize>
</ns2:paramsGetLeadChanges>

Response:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:successGetLeadChanges xmlns:ns2="http://www.marketo.com/mktows/">
    <result>
        <returnCount>25</returnCount>
        <remainingCount>0</remainingCount>
        <newStartPosition>
            <latestCreatedAt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
            <oldestCreatedAt>2013-10-25T15:14:13.034-07:00</oldestCreatedAt>
            <activityCreatedAt>2013-10-25T15:14:13.034-07:00</activityCreatedAt>
            <offset>ID:12281825</offset>
        </newStartPosition>
        <leadChangeRecordList>
            <leadChangeRecord>
                <id>12281801</id>
                <activityDateTime>2013-10-25T17:37:57-05:00</activityDateTime>
                <activityType>Delete Lead from SFDC</activityType>
                <mktgAssetName>sd 1</mktgAssetName>
                <activityAttributes>
                    <attribute>
                        <attrName>Lead ID</attrName>
                        <attrType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
                        <attrValue>1321071</attrValue>
                    </attribute>
                </activityAttributes>
                <mktPersonId>1321071</mktPersonId>
            </leadChangeRecord>
            <leadChangeRecord>
.......
 
        </leadChangeRecordList>
    </result>
</ns2:successGetLeadChanges>