I have created an Html form on my marketing cloud landing page and I am creating a lead on the form submission using CreateSalesforceObject() function. All the form fields are being captured well except one checkbox field. I am using the request parameter to fetch the checkbox value but it's giving me error500. Can anybody help me how to resolve this issue?


1 Answer 1


My guess is that you need to define a true or false value.

If your HTML looks like this:

<input type="checkbox" name="consent" value="true">

Then in your AMPscript code block, use the following syntax (obviously change the arguments as required):

  var @consent, @createLead

  set @consent = iif(RequestParameter('consent')==true,'true','false')

  set @createLead = CreateSalesforceObject(
        "Lead", 5,
        "FirstName", RequestParameter("firstname"),
        "LastName", RequestParameter("lastname"),
        "Company", RequestParameter("company"),
        "Email", RequestParameter("email"),
        "Consent__c", @consent
  • Thanks mate. it worked like magic. Also upon submission, I want to redirect to my 'Thanks for submission' page. how to do i do that. any clues?
    – MikeT
    Oct 14, 2020 at 7:19
  • Yes, simply add the Redirect function after the CreateSalesforceObject function, like: Redirect("https://mysubmissionpage.com") or another CloudPage: Redirect(CloudPagesURL(123)) Oct 14, 2020 at 7:24
  • Thanks a lot, Eliot. Just one last query. is it possible that After the Lead has completed the form they should receive a confirmation email to their provided Email? IF they click the link to confirm, the Lead Records OwnerId in CRM should change. I am not sure how should i approach towards this.
    – MikeT
    Oct 14, 2020 at 10:46
  • @MikeT, that's a completely different question. I would suggest you create a new question for that. Also, SFSE isn't a free code-writing service, so please provide an example of what you have tried, so we can help you. Oct 14, 2020 at 22:24

You must log in to answer this question.

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