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
]%%