0

PHP's startker-kit has an UpdateAdd save action, which basically inserts a row if its ID doesn't exist and updates it if the id exists.

Is there an equivalent in PHP's Fuel-SDK? Or do I need to write code to check if the given row id already exists?

Thanks.

1

I'll answer my own question: No.

I got around by doing a post and checking if an error is returned complaining about key constraints, if so do a patch.

0

Somehow the upsert part on FuelSDK core (ET_Patch class __construct) isn't used on patch(). Also a known feature request/update on https://github.com/salesforce-marketingcloud/FuelSDK-CSharp/issues/48.

Instead, I use a filter on a Row->get() to do my thing.

    $row = new ET_DataExtension_Row();
    $row->authStub = $client;       
    $row->filter = ['Property' => 'SubscriberKey', 'SimpleOperator' => 'equals', 'Value' => 123920932];        
    $row->props = ["SubscriberKey"]; 
    $response = $row->get();

    if (!count($response->results)) {
        // use post            
    } else {
        // use patch
    }

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.