0

Hello ExactTarget Experts,

I'm currently trying to create a landing page on where the form values will be inserted in ET Data Extension I have tried below codes from How to Fetch a html form's Post variables using AMPSCRIPT and create a record with the values in salesforce objects and put it in Cloudpages or Landing page. But I'm experiencing "500 Internal Server Error". I already edited the 'MyDataExtensionName' and the fields based on the data extension.

Maybe I'm having this error because I'm not sure what to put in 'Account' in CreateSalesForceObject(), could you help on this on where I could find the right string to use? I also checked the ET documentation about this but I don't know what to use in the 1st parameter string.

<html lang="en">
  <head>
  </head>
  <body>
     %%[
        var @email, @firstName, @lastName, @createSfRecord, @createDeRecord

        set @firstName = RequestParameter('firstName')
        set @lastName = RequestParameter('lastName')
        set @email = RequestParameter('email')

        if RequestParameter("submitted") == "submitted" then

         set @createSfRecord = CreateSalesforceObject(
           'Account', 3,
           'FirstName', @firstName,
           'LastName', @lastName,
            'Email', @email)

         set @createDeRecord = InsertDE(
           'MyDataExtensionName',
           'First Name',@firstName,
           'Last Name',@lastName,
           'Email',@email)
        endif

    ]%%

 <form action="%%=RequestParameter('PAGEURL')=%%" method="post">
  <label>First Name</label>
  <input type="text" name="firstName">

  <label>Last Name</label>
  <input type="text" name="lastName">

  <label>Email</label>
  <input type="text" name="email">

  <input id="submitted" type="hidden" name="submitted" value="submitted" />

  <input type="submit" value="Submit">
 </form>

 %%=IIF(RequestParameter("submitted") == "submitted", '<p>Your form has been submitted.</p>','')=%%

 </body>
</html>

1 Answer 1

1

'Account' is the name of the Salesforce object that you are inserting a record into. You will need to update this to the Object name that you are using to create the record in.

Also, check the Object and confirm that it contains fields with the API Names 'FirstName', 'LastName' and 'Email'.

If you still have issues, you can debug what is occurring by creating an email with the following code:

 %%[
    var @email, @firstName, @lastName, @createSfRecord

    set @firstName = 'Sam'
    set @lastName = 'Sample'
    set @email = '[email protected]'

    set @createSfRecord = CreateSalesforceObject(
       'Account', 3,
       'FirstName', @firstName,
       'LastName', @lastName,
       'Email', @email)

 ]%%

It works!

Save the email, then click on the text tab and delete the AMPscript block (to prevent the request being made twice). Click Send Preview and preview any Subscriber in the All Subscribers list.

You will either see the error details on the preview page, or it will create a record with the specified variables.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .