I created an ampscript on a Landing page that should update Salesforce boolean fields and also suppress the current value of a specific text field (so that we get an empty value). The URL of the Landing Page is integrated on a email, and the SubscriberKey is embedded in the url. Example: http://sfmc-landingpage.com?c=%%_subscriberkey%%
Here is the ampscript :
%%[
SET @ContactID = QUERYPARAMETER('c')
SET @AccountID = Lookup ("ENT.Contact_Salesforce", "AccountId", "_ContactKey", @ContactID)
IF @ContactID != "" THEN
SET @ContactOptout1 = UpdateSingleSalesforceObject("Contact",@ContactID,"Optin_A__c","false")
SET @ContactOptout2 = UpdateSingleSalesforceObject("Contact",@ContactID,"Optin_B__c","false")
SET @ContactOptout3 = UpdateSingleSalesforceObject("Account",@AccountID,"ID_Company__c", " ")
ENDIF
]%%
I tested in the Preview and Test steps of an Email with a specific contact, and after a click on the url, it worked fine, the boolean and text fields were updated as we wanted.
However, when I tried with a real send, the boolean fields were updated, but not the text field. The value has not been replaced by "empty". The client use PersonAccount. The boolean fields are on the Contact object and the Text field is on the Account object.
Would you have any idea of why it did not work on a real send (but it worked with Preview and Test)? Is the syntax for an empty field OK on the ampscript ? If not, how would be the right syntax? (I added a space between the quote for "empty")
Thank you
Regards
Ludivine