I am trying to figure out how to duplicate an existing Data Extension. That is, for a defined Data Extension, I want to duplicate it, along with the columns and the data in it.
Here's what I think I need to do. For a given Data Extension, we:
- Retrieve fields in the Data Extension using
DataExtensionField
object - Use
DataExtensionFieldType
object to get the field type (Text, Number, Boolean, etc) of each field returned from step 1 - Retieve records from Data Extension in step 1 using
DataExtensionObject
object - Create new Data Extension using
DataExtensionFromAPI
setting the columns and field types from steps 1 and 2 - Add data from step 3 to new
DataExtensionObject
Can someone confirm if this is actually correct? From following the documentation, the issue with this proposed approach is that there does not seem to be a method to retrieve Data Extension field types. According to the documentation, there are no methods supported for the DataExtensionFieldType Object.
I'm at a bit of a loss here how to approach this seemingly straightforward task...
Attribution to: Eliot Harper
Possible Suggestion/Solution #1
Super close -
Step 1 will retrieve the fields and field types togethers like this:
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Header>
<ns1:fueloauth xmlns:ns1="http://exacttarget.com">xxxxxxxxxxxxxx</ns1:fueloauth>
</Header>
<Body>
<RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
<RetrieveRequest>
<ObjectType>DataExtensionField</ObjectType>
<Properties>ObjectID</Properties>
<Properties>Name</Properties>
<Properties>FieldType</Properties>
<Filter xsi:type="SimpleFilterPart">
<Property>DataExtension.CustomerKey</Property>
<SimpleOperator>equals</SimpleOperator>
<Value>myDEKey</Value>
</Filter>
</RetrieveRequest>
</RetrieveRequestMsg>
</Body>
</Envelope>
The rest of your steps look correct.
Attribution to: Kelly J Andrews
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/31606