I've made a preference page in which the form directly communicates with the connected Salesforce environment. I save the customer's data via the UpdateSingleSalesforceObject() function, and I retrieve their data to prefill the form using the RetrieveSalesforceObject() function. I do this to make sure the displayed data is always accurate.
However, the RetrieveSalesforceObject() function causes the page to load very slowly (>8 sec loading time). I tested the page in a couple of online webpage performance meters. The majority of the loading time is classified as 'Wait' time.
This is the code I use for firstName, this block is repeated 8 times each for different attributes (last name, phone number etc.)
SET @firstNameObject = RetrieveSalesforceObjects('Contact', 'FirstName', 'Id', '=', @id) IF RowCount(@firstNameObject) > 0 THEN SET @firstNameRow = Row(@firstNameObject, 1) SET @firstName = Field(@firstNameRow, "FirstName") ENDIF
Does anybody know how I can optimize this so the load time is a lot less?