0

I have a landing page where I'm trying to update data extensions in different Business Units with UpdateDE, but maybe I need to specify ClientID somehow?

0

AMPScript and SSJS are tied to the Business Unit they are being used in - no exceptions.

The only way to accomplish what you want is via a SOAP or REST API call. Both AMPscript and SSJS do offer inherit API capabilities, but again, these are tied to the current BU only.

I highly recommend the REST call as it is more efficient, more robust, easier to use in SSJS and AMpscript and easier to learn. It also provides an UPSERT option, where SOAP requires either Create or Update only.

See below sample SOAP envelope:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
     <soap:Header>
          <wsse:Security soap:mustUnderstand="1">
               <wsse:UsernameToken wsu:Id="SecurityToken-6421ac0b-a454-42a3-99f7-a77ace024446"> 
                                                      <wsse:Username>XXXXX</wsse:Username>
                    <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">XXXXX</wsse:Password>     
               </wsse:UsernameToken>
          </wsse:Security>
     </soap:Header>
     <soap:Body>
          <UpdateRequest xmlns="http://exacttarget.com/wsdl/partnerAPI">
         <Options/>
         <Objects xsi:type="DataExtensionObject">
                         <PartnerKey xsi:nil="true"/>
                         <ObjectID xsi:nil="true"/>
                         <CustomerKey>Definition_Key</CustomerKey>
                         <Properties>
                              <Property>
                                   <Name>EmailAddress</Name>
                                   <Value>johndoe@example.com</Value>
                        </Property>
                        <Property>
                        <Name>FirstName</Name>
                           <Value>John</Value>
                        </Property>
                        <Property>
                           <Name>LastName</Name>
                           <Value>Doe</Value>
                        </Property>
                        <Property>
                           <Name>PrimaryKey</Name>
                           <Value>PrimaryKey</Value>
                        </Property>
                    </Properties>
                 </Objects>
        </UpdateRequest>
    </soap:Body>
</soap:Envelope>

Be aware there is no 'UPSERT' inside of SOAP API, so you will need to specify either Update or Create Request on the call.

Below is the sample REST call:

Host: https://www.exacttargetapis.com
POST /hub/v1/dataevents/11954DDF-28A3-4FE8-BF77-646C37506621/rowset
Content-Type: application/json
Authorization: Bearer YOUR_ACCESS_TOKEN

[
    {
        "keys":{
                "Email": "someone@example.com"
                },
        "values":{
                "LastLogin": "2013-05-23T14:32:00Z",
                "IsActive": true,
                "FirstName": "John",
                "FollowerCount": 2,
                "LastName": "Smith"
                }
    },
    {
        "keys": {
                "Email": "someone2@example.com"
                },
        "values":{
                "LastLogin": "2013-05-23T14:32:00Z",
                "IsActive": true,
                "FirstName": "Jane",
                "FollowerCount": 2,
                "LastName": "Smith"
                }
    }
]

The REST call will provide an UPSERT, meaning it will add or update.

REST is also easier to accomplish via SSJS or AMPScript by using the POST options.

Please note that each of these will require authentication - whether user/pass in SOAP or Oauth Token inside REST. This will also designate the BU that will be targeted.

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.