0

I would like to be able to create a custom object record from a one click on a cloud pages, page. I am looking for the method that I would go about this? The information that I am seeing on the help page states the following: https://help.salesforce.com/articleView?id=mc_es_smart_capture_form_actions.htm&type=5

'Salesforce: Add record to Salesforce Object' but I am not able to find more information about how I would parse the information to Salesforce. I do not want to ingest this straight in to Marketing Cloud.

3

Firstly I would like to thank Eliot Harper for creating this amazing site Ampscript Guide.

CreateSalesforceObject

To demonstrate I have created a Custom object called Animal in Sales Cloud.
With a standard field Name and a custom field Animal_type

enter image description here

Next you must create a Cloud-Page as below (change the UI as required). enter image description here

%%[
if RequestParameter("submitted") == true then
set @createAnimal = CreateSalesforceObject(
        "Animal__c", 2,
        "Name", RequestParameter("AnimalName"),
        "Animal_type__c", RequestParameter("AnimalType"),
       )
endif
]%%

<!DOCTYPE html>
<html>
   <body>
      %%[ if not empty(@createAnimal) then ]%%
         <p>%%=v(@createAnimal)=%% record created in Animal Object</p>
      %%[ endif ]%%
      <h2>Register</h2>
      <form action="%%=RequestParameter('PAGEURL')=%%" method="post">
         <label>Animal Name: </label>
         <input type="text" name="AnimalName">
         <label for="AnimalType">Animal Type: </label>
         <select name="AnimalType">
            <option value="Pet">Pet</option>
            <option value="Wild">Wild</option>
         </select>
         <input name="submitted" type="hidden" value="true" />
         <input type="submit" value="Submit">
      </form>
   </body>
</html>

Then once you submit the form, enter image description here

A new record will be created in Sales cloud and 18digit record ID will be returned. enter image description here

You can use this ID to find the newly created record in Sales cloud. enter image description here

| improve this answer | |
  • Yes, this is the way to go. Forget about the smart capture with salesforce link. This only works with the legacy "Landing Pages" feature in Classic Content. Besides not being available to most customers anymore it has been a massive pain in the a** that was sometimes more tricky than starting from scratch based on the approach described here. – Stephan de Paly Mar 12 at 22:51

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.