-1

I have this piece of code. Upon adding this to the CloudPage, it break the page and show 500-Internal Server Error. According to me "UpdateSingleSalesforceObject" is causing this behavior.Can somebody please suggest a workaround for this.

%%[
SET @firstname = RequestParameter("FirstName")
SET @lastname = RequestParameter("LastName")
SET @email = RequestParameter("EmailAddress")
SET @company = RequestParameter("Company")
]%%


%%[
IF NOT EMPTY(@email) THEN
SET @lead = RetrieveSalesforceObjects('Lead', 'Id', 'Email', '=', @email)

IF RowCount(@lead) > 0 THEN
SET @result = UpdateSingleSalesforceObject('Lead',Field(Row(@lead, 1),Id),First Name,@firstname,Last Name,@lastname,Company,@company)

ELSE
SET @result = CreateSalesforceObject('Lead', 3, 'First Name', @firstname, 'Last Name', @lastname, 'Email', @email, 'Company', @company)

ENDIF
ELSE
OUTPUT("Email must be provided in form")

ENDIF
]%%
2

You have no quotes around the field names in your update call.

That should be it. The rest looks fine at first glance.

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.