I want help in AMP script for below scenario

I am creating a donation page on CloudPage in which there are multiple radio buttons for donation amount i.e. $1,000, $500 etc and so on.

I want to create an opportunity using the donation amount but have no clue how the selected radio button value can be passed on. Can anybody help how can this be achieved?

2 Answers 2


Since Amscpript only runs when loading the page, you will need to create a second cloudpage which processes the values entered in your form. Let me share a very minimalist example I've used to illustrate the concept.

Form Page

<form action="%%=RedirectTo(CloudPagesURL( yourprocessingpagehere ))=%%">
    <div class="radio-options">
            <input type="radio" id="radio_0" name="proof" value="0" %%=v(@radio0)=%% />
            <input type="radio" id="radio_1" name="proof" value="1" %%=v(@radio1)=%%/>
            <input type="radio" id="radio_2" name="proof" value="2" %%=v(@radio2)=%% />
    <input type="submit" value="submit">

Processing Page

var @Proof, @Id

//This is how you retrieve the value of your parameter
set @Proof = RequestParameter("proof")

//Use this function to create your opportunity
set @Id = CreateSalesforceObject('opportunity', 1, 'FirstName', 'Chris', 'DonationAmount__c', @Proof)

Some details about the CreateSalesforceObject function

  • Thanks but is there any another way within the same cloudpage instead of creating a new one? Oct 7, 2019 at 4:59
  • I don't believe it's possible, because you can only run ampsrcript on page load. You could do an Ajax callout to a seperate cloud page if its really important for you to stay on the same page, but please be aware of the security implications of using this method. Another way to go could be to host a public site directly on your force. Com platform. This would give you some more flexibility
    – RickForce
    Oct 7, 2019 at 6:40
  • I think I was able to do it with the help of some other StackExchange post. Oct 7, 2019 at 7:12
  • Could you share your solution? It would be interesting for me and others.
    – RickForce
    Oct 7, 2019 at 7:18
  • 3
    You can post it to the same page using RequestParameter('PAGEURL'), take a look here for a solution which posts the form to itself: sfmarketingcloudhome.wordpress.com/2019/08/19/…
    – zuzannamj
    Oct 7, 2019 at 9:54
set @amount1000  = "false"
set @amount500  = "false"
set @amount250  = "false"
set @amount100  = "false"
set @amount50  = "false"
set @answer = requestparameter ("amount")

  if @answer == "1000" then 
        set @amount = "1000"
  elseif @answer == "500" then 
        set @amount = "500"
  elseif @answer == "250" then 
        set @amount = "250"
  elseif @answer == "100" then 
        set @amount = "100"
  elseif @answer == "50" then 
        set @amount = "50"

HTML Code:

<input type="radio" name="Amount" value="1000" %%=IIF(@amount1000, "checked", "1000")=%%> $ 1,000.00<br>
  <input type="radio" name="Amount" value="500" %%=IIF(@amount500, "checked", "500")=%%> 
$ 500.00 <br>

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.