0

I've created a landing page that updates some fields in Salesforce Object 'MktStatus__c'.

%%[
 var @updateRecord
    set @sk = '003D000000zm6gXIAQ'
    set @mct = '03'
    set @fieldname1 = concat('OptInMcT',@mct,'Date__c')
    set @fieldname2 = concat('OptInMcT',@mct,'Source__c')
    set @fieldname3 = concat('OptInMcT',@mct,'Status__c')
    set @fieldname4 = concat('OptInMcT',@mct,'__c')


if not empty(@mct) then
set @updateRecord = UpdateSingleSalesforceObject(
'MktStatus__c',@sk,
@fieldname1,Now(),
@fieldname2,03,
@fieldname3,04,
@fieldname4,02
)

else 
set @updateRecord = UpdateSingleSalesforceObject(
'MktStatus__c',@sk,
'OptInMcC01Date__c',Now(),
'OptInMcC01Source__c',03,
'OptInMcC01Status__c',04,
'OptInMcC01__c',02
)
endif
]%%

The issue is that every time I run the landing page it shows an ERROR 500, and if I do the preview including the code in an email it displays an error saying:

'Call to update the salesforceobject MktStatus__c ID = 003D000000zm6gXIAQ failed! Error in the application.'

The record exists, the concat function and the fields name are okay, and the API user has the permissions to view and edit any object/field in Salescloud. I also noticed that this issue happens when I try to update anything in any object, but everything is okay when I have to read (e.g. using RetrieveSalesforceObjects AMPScript function).

I don't know what else to do to identify the issue. May it is related to the Marketing Cloud Connector set-up?

1

It might have to do with the date format - your first field is a Date, which is notoriously problematic.

Try:

FormatDate(NOW(),"iso") 

instead of

Now()

.

| improve this answer | |
1

The problem was related to the ID we were using as the second parameter of the function was the wrong one.

| improve this answer | |

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.