0

I have a Data Extension field I'd like to delete, but that DE is used in an attribute group/set in Contact Builder. So is it really necessary to delete the data relationship first before I can remove the field? Seems too risky if that's the case.

  • 1
    Yes, seems you have to remove the relationship first. Otherwise, you can't delete it. – daniel wu Jul 14 '17 at 20:51
1

It is indeed possible to remove a field in a linked Data Extension, with a small workaround. Using SOAP, I have successfully removed a field, without unlinking the Data Extension in Data Designer. You need to perform two calls to achieve this: 1: Retrieve details for the data extension in which you want to delete the field. You will need the Object ID of the field later:

<?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>
      <fueloauth xmlns="http://exacttarget.com">**** Access Token ****</fueloauth>
   </s:Header>
   <s:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
         <RetrieveRequest>
            <ObjectType>DataExtensionField</ObjectType>
            <Properties>Name</Properties>
            <Properties>ObjectID</Properties>
            <Filter xmlns:ns1="http://exacttarget.com/wsdl/partnerAPI" xsi:type="ns1:SimpleFilterPart">
               <Property>DataExtension.CustomerKey</Property>
               <SimpleOperator>equals</SimpleOperator>
               <Value>**** Data Extension External Key ****</Value>
            </Filter>
         </RetrieveRequest>
      </RetrieveRequestMsg>
   </s:Body>
</s:Envelope>

2: Execute the Delete request, pointing at the Data Extension / Field:

<?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>
      <fueloauth xmlns="http://exacttarget.com">**** Access Token ****</fueloauth>
      <a:Action s:mustUnderstand="1">Delete</a:Action>
      <a:MessageID>urn:uuid:d5c8c2ee-384e-4492-af18-b01e0d438b62</a:MessageID>
      <a:ReplyTo>
         <a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
      </a:ReplyTo>
      <a:To s:mustUnderstand="1">https://**** Your SOAP Subdomain ****.soap.marketingcloudapis.com/Service.asmx</a:To>
   </s:Header>
   <s:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <DeleteRequest xmlns="http://exacttarget.com/wsdl/partnerAPI">
         <Options />
         <Objects xsi:type="DataExtension">
            <PartnerKey xsi:nil="true" />
            <ObjectID xsi:nil="true" />
            <CustomerKey>**** Data Extension External Key ****</CustomerKey>
            <Fields>
               <Field>
                  <ObjectID>**** Object ID of the field to delete (from first call) ****</ObjectID>
               </Field>
            </Fields>
         </Objects>
      </DeleteRequest>
   </s:Body>
</s:Envelope>

Don't panic if the field is not removed straight after the code is executed. It can take few minutes, and the values for the field are set to undefined for all the records, before the field is removed.

0

Yes, it turns out you need to delete the relationship first, so removing a field of that data extension is possible.

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.