I am getting the Internal Server Error 500 when using the UpdateSingleSalesforceObject on a CloudPage while attempting to retrieve and output Salesforce Fields such as 'Email' and 'FirstName' from a known contactKey found in SalesForce. When I run the block of code below without attempting to output the fields 'Email' and 'FirstName' the code results in displaying a count of the number of records found. Both Salesforce and SFMC are connected via the connector. Is there anything in this code that would prevent displaying of SF field data from within Marketing Cloud? What about any special permissions needing to be enabled? Are there any needed to display fields?
%%[ var @cntr, @rowset, @row, @numberOfRows, @id, @email
Set @rowset = RetrieveSalesforceObjects("Contact","Id,Email,FirstName","Id", "=","0033h00000k2sBYZZZ")
set @numberOfRows = RowCount(@rowset)
IF @numberOfRows == 1 then
set @row = Row(@rs, @cntr)
]%%
Email: %%=v(Field(@row, "Email"))=%%:<br>
FirstName: %%=v(Field(@row, "FirstName"))=%%:<br>
Total Records: %%=v(@numberOfRows)=%%<br>
%%[ endif ]%%
@row
. It also has no output if @numberofRows is > 1 in the example.