0

I'm looking into creating a custom preference/subscription center for my client. They are using Salesforce as their CRM system so all subscriber information will reside in that database. Can we just create a simple Sites page to manage subscription info directly in SFDC or do we have to push the data into ET as well?

2

We do this frequently. You don't necessarily need to store this data in Data Extensions.

You would create a new page in CloudPages or Microsites and retrieve or update the Sales Cloud record directly using AMPscript. Here are the key AMPscript functions that you would need to use:

  1. Pass the Salesforce Account or Contact Id to the page as a request parameter and then use the RequestParameter() function to retrieve this for use in subsequent functions.
  2. Use the RetrieveSalesforceObjects() function to retrieve fields for the Salesforce Account/Contact Id retrieved from the request parameter to pre-populate your form with the values.
  3. Use the UpdateSingleSalesforceObject to update the record in the Salesforce object with the form data the form is posted.

Here's some sample AMPscript code to retrieve values from a Salesforce Object:

<script runat=server language=ampscript>

var @Id, @retrievePersonAccountRecord, @limitRow, @mobileNumber, @dateofBirth, @birthDay, @birthMonth, @birthYear, @hobby

set @Id = RequestParameter('id')

set @retrievePersonAccountRecord = RetrieveSalesforceObjects('Account','PersonMobilePhone, Date_of_Birth__c, Interests__c','Id', '=', @Id)
set @limitRow = Row(@retrievePersonAccountRecord, 1)
set @mobileNumber = Field(@limitRow, "PersonMobilePhone")
set @dateofBirth = Field(@limitRow, "Date_of_Birth__c")
set @birthDay = Field(@limitRow, Substring(@dateofBirth,9,2))
set @birthMonth = Field(@limitRow, Substring(@dateofBirth,6,2))
set @birthYear = Field(@limitRow, Substring(@dateofBirth,0,4))
set @hobby = Field(@limitRow, "Interests__c")
</script>

You can then use inline AMPscript to populate the fields. For example, %%=v(@mobileNumber)=%%

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.