I'm trying to retrieve some fields from the Account object in a Salesforce org connected by the MC Connector in order to eventually pre-populate a preference page. This is the AMPscript I'm using but It's not working and I can't see any issues with it.
%%[ SET @SubscriberKey = '0030N000025L06hQAC' SET @rs = RetrieveSalesforceObjects("account", "Email_Opt_In__c,Phone_Opt_In__c", "Contact_ID__c", "=", @SubscriberKey) IF NOT Empty(@rs) THEN Set @row = ROW(@rs,1) Set @Email = FIELD(@row,"Email_Opt_In__c") Set @Phone = FIELD(@row,"Phone_Opt_In__c") ENDIF IF @Email == 'TRUE' THEN SET @EmailValue = 'Checked' ENDIF IF @Phone == 'TRUE' THEN SET @PhoneValue = 'Checked' ENDIF ]%% Subkey: %%=v(@SubscriberKey)=%% <br> Email: %%=v(@Email)=%% <br> Phone: %%=v(@Phone)=%% <br> EmailValue: %%=v(@EmailValue)=%% <br> PhoneValue: %%=v(@PhoneValue)=%% <br>
I've hardcoded the subscriberkey for now and I've checked the Account synchronised data extension and the person exists in there with the correct ID, so I'm a bit stumped. So far all I'm seeing is SubscriberKey. Any help would be much appreciated.