I have a backbone of code where I am passing subscriber key to a landing page from an email. I want that when a subscriber clicks and is redirected to the page to update 2 records in salesforce.
I am able to pass the info of Subscriber Key in the URL & I am able to do the RetrieveSalesforceObjects but not the UpdateSingleSalesforceObject. I dont know what I am missing.
Below is the code from my page & info populated when redirect link from email is clicked:
%%[ var @SubscriberKey, @SalesforceID,@AccountIsFound, @ContactIsFound, @Proceed, @Certification,@Known, @updateRecord, @valueCert, @valueKnown
/* Get parameters passed through the URL */
SET @SubscriberKey = QueryParameter("SubscriberKey")
SET @SalesforceID = Substring(@SubscriberKey, 0, 15)
SET @AccountIsFound = "False"
SET @ContactIsFound = "False"
SET @Proceed = "True"
/* Get Account information using the contact ID */
SET @AccountRowset = RetrieveSalesforceObjects("Account", "Id, PersonEmail, PersonContactId, Certification__pc, Known_As__pc",
"PersonContactId", "=", @SalesforceID)
/* If it finds an account, get data from it */
IF RowCount(@AccountRowset) > 0 THEN
SET @AccountIsFound = "True"
SET @AccountRow = Row(@AccountRowset,1)
SET @AccountID = FIELD(@AccountRow, "Id")
SET @Email = FIELD(@AccountRow, "PersonEmail")
SET @Certification=FIELD(@AccountRow,"Certification__pc")
SET @Known=FIELD(@AccountRow,"Known_As__pc")
ELSE
SET @Proceed = "False"
InsertDE("Preference Centre Error Log", "SubscriberKey", @SubscriberKey,
"Custom Message", "Account Not Found",
"Status Message", "ERROR",
"Error Date", NOW())
ENDIF
SET @valueCert='BOZI'
SET @valueKnown='GDPR'
set @updateRecord=UpdateSingleSalesforceObject("Account",@Id,"Certification__pc",@valueCert,"Known_As__pc",@valueKnown)
]%%
<br>
18 char Contact ID: %%=v(@SubscriberKey)=%%
<br>
15 char Contact ID: %%=v(@SalesforceID)=%%
<br>
%%=v(@AccountRowset)=%%
<br>
Email from Account : %%=v(@Email)=%%
<br>
Certification: %%=v(@Certification)=%%
<br>
Known : %%=v(@Known)=%%
<br>
<html>
%%[if @updateRecord == 1 then]%%
﹤p﹥Record Updated﹤/p﹥
%%[ elseif @updateRecord == 0 then]%%
﹤pUpdate Failed﹤/p﹥
%%[endif]%%
</html>