1

I almost have it, but need some help translating into AMPScript how to get the SendableDataExtensionField.Name, SendableSubscriberField.Name and Template.CustomerKey when retrieving the DE object structure. Below is the code I currently have:

%%[

/* ==================================== */
/* Retrieve Data Extension */
/* ==================================== */

SET @rrDE = CreateObject("RetrieveRequest")
SetObjectProperty(@rrDE, "ObjectType", "DataExtension")

AddObjectArrayItem(@rrDE,"Properties","Name")
AddObjectArrayItem(@rrDE,"Properties","ObjectID")
AddObjectArrayItem(@rrDE,"Properties","CustomerKey")
AddObjectArrayItem(@rrDE,"Properties","PartnerKey")
AddObjectArrayItem(@rrDE,"Properties","Description")
AddObjectArrayItem(@rrDE,"Properties","IsSendable")
AddObjectArrayItem(@rrDE,"Properties","IsTestable")
AddObjectArrayItem(@rrDE,"Properties","CategoryID")
AddObjectArrayItem(@rrDE,"Properties","Status")
AddObjectArrayItem(@rrDE,"Properties","IsPlatformObject")
AddObjectArrayItem(@rrDE,"Properties","DataRetentionPeriodLength")
AddObjectArrayItem(@rrDE,"Properties","DataRetentionPeriodUnitOfMeasure")
AddObjectArrayItem(@rrDE,"Properties","RowBasedRetention")
AddObjectArrayItem(@rrDE,"Properties","ResetRetentionPeriodOnImport")
AddObjectArrayItem(@rrDE,"Properties","DeleteAtEndOfRetentionPeriod")
AddObjectArrayItem(@rrDE,"Properties","RetainUntil")
AddObjectArrayItem(@rrDE,"Properties","Template.CustomerKey")
AddObjectArrayItem(@rrDE,"Properties","SendableSubscriberField.Name")
AddObjectArrayItem(@rrDE,"Properties","SendableDataExtensionField.Name")


/* AddObjectArrayItem(@rrDE,"Properties","DataRetentionPeriod") << THIS DOES NOT WORK */ 

SET @sf1 = CreateObject("SimpleFilterPart")
SetObjectProperty(@sf1, "Property", "CustomerKey")
SetObjectProperty(@sf1, "SimpleOperator", "equals")
AddObjectArrayItem(@sf1, "Value", "SAMPLE_DE_CUSTOMER_KEY")

SetObjectProperty(@rrDE, "Filter", @sf1)

/* Execute the Retrieve */
SET @rr = InvokeRetrieve(@rrDE)
set @cnt = RowCount(@rr)


FOR @i = 1 to @cnt DO
    SET @curRow = Row(@rr, @i)
    SET @objID = Field(@curRow,"ObjectID")
    SET @CustomerKey = Field(@curRow,"CustomerKey")
    SET @Name = Field(@curRow,"Name")
    SET @PartnerKey = Field(@curRow,"PartnerKey")
    SET @Description = Field(@curRow,"Description")
    SET @IsSendable = Field(@curRow,"IsSendable")
    SET @IsTestable = Field(@curRow,"IsTestable")
    SET @CategoryID = Field(@curRow,"CategoryID")
    SET @Status = Field(@curRow,"Status")
    SET @IsPlatformObject = Field(@curRow,"IsPlatformObject")
    SET @DataRetentionPeriodLength = Field(@curRow,"DataRetentionPeriodLength")
    SET @DataRetentionPeriodUnitOfMeasure = Field(@curRow,"DataRetentionPeriodUnitOfMeasure")
    SET @RowBasedRetention = Field(@curRow,"RowBasedRetention")
    SET @ResetRetentionPeriodOnImport = Field(@curRow,"ResetRetentionPeriodOnImport")
    SET @DeleteAtEndOfRetentionPeriod = Field(@curRow,"DeleteAtEndOfRetentionPeriod")
    SET @RetainUntil = Field(@curRow,"RetainUntil")

    if @IsSendable == "True" then

        /* ============================================================== */
        /* THIS PORTION IS WHERE I NEED HELP getting the following information  */
        /* ============================================================== */
        SET @SendableDataExtensionField = Field(@curRow,"SendableDataExtensionField")


        SET @SendableSubscriberField = Field(@curRow,"SendableSubscriberField")


        SET @Template = Field(@curRow,"Template")
        /* ============================================================== */
        /* ============================================================== */

    endif

NEXT @i

]%%

1 Answer 1

0

Not all of the properties are retrievable, unfortunately.

Here are the ones I generally retrieve:

<s:Envelope xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:s="http://www.w3.org/2003/05/soap-envelope">
    <s:Header>
        <a:Action s:mustUnderstand="1">Retrieve</a:Action>
        <a:MessageID>urn:uuid:aed8509c-af42-4444-99ef-f4dfd38f5ba9</a:MessageID>
        <a:ReplyTo>
            <a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
        </a:ReplyTo>
    </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>
                <ClientIDs>
                    <ClientID>1111111</ClientID>
                    <ID>111111</ID>
                </ClientIDs>
                <ObjectType>DataExtension</ObjectType>
                <Properties>ObjectID</Properties>
                <Properties>Name</Properties>
                <Properties>CustomerKey</Properties>
                <Properties>Description</Properties>
                <Properties>CategoryID</Properties>
                <Properties>IsSendable</Properties>
                <Properties>SendableDataExtensionField.Name</Properties>
                <Properties>SendableSubscriberField.Name</Properties>
                <Properties>RowBasedRetention</Properties>
                <Properties>DataRetentionPeriodLength</Properties>
                <Properties>DeleteAtEndOfRetentionPeriod</Properties>
            </RetrieveRequest>
        </RetrieveRequestMsg>
    </s:Body>
</s:Envelope>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .