0

We have a Registration Form with Fields

  1. FirstName
  2. Email
  3. Phone
  4. Job Function
  5. Status

When someone enters details on the form and clicks on submit the data is stored in MC and creates a Lead in CRM.We have an email post that where there are 2 CTA buttons (Yes/ No). If someone clicks on Yes, it redirects to a CloudPage.

I am adding this Ampscript Logic on the CloudPage

%%[ 
set @Email = RequestParameter("Email")
set @Id = RequestParameter("Id") 
set @UpdateRowsinDE = UpsertDE("ResponseDE",1,'Id',@Id, "Status",'closed' )
set @UpdateRowinHC = UpdateSingleSalesforceObject('Request__c',@Id,'Status__c', 'Closed' ) 

]%%

Issue : Instead of updating the record which was initially created through the form its adding a new row just with that field mentioned in AMPscript.

I want the record who entered details on the first form to get updated

1 Answer 1

0

Updated:

Pass parameters to a Cloudpage:

%%[
    set @Id = AttributeValue("Id column name")
    set @Email = AttributeValue("Email column name")

    set @CTA_Url = CloudPagesURL("Cloud page Id", "Id", @Id, "Email", @Email)                                          
]%%                                                

<!-- CTA button -->
<a href="%%=RedirectTo(@CTA_Url)=%%">Your CTA button</a>

Since you didn't post the AMPscript code in your email so I assume that you passed the parameters for "Email" and "Id" properly to the CTA URL.

One thing I notice that you are using UpsertDE function for your Cloudpage instead of using UpsertData function.

Based on the document of UpsertDE function

Use this function with email messages at send time only

Therefore you would want to try this on your Cloudpage:

%%[ 
set @Email = RequestParameter("Email")
set @Id = RequestParameter("Id") 
set @UpdateRowsinDE = UpsertData("ResponseDE",1,'Id',@Id, "Status",'closed' )
set @UpdateRowinHC = UpdateSingleSalesforceObject('Request__c',@Id,'Status__c', 'Closed' )
]%%
7
  • I think i am missing what you said "parameters passed for email and id to CTA url" How do i do that? I did not add any code to my email CTA button. I just added the cloudpage link to the layout.
    – Reva
    Commented Sep 2, 2023 at 18:47
  • I have updated the answer.
    – Duc Le
    Commented Sep 3, 2023 at 1:27
  • I am unable to add AMpscript code to the Button. For the CTA buttons in email, i used a layout content type and then added button content type. I am unable to edit the code through HTML editor in the Button content type
    – Reva
    Commented Sep 3, 2023 at 17:58
  • 1
    You can create a separate code snippet for the AMPscript and a separate button by HTML so it would be more flexible
    – Duc Le
    Commented Sep 4, 2023 at 1:05
  • My SFMC DE is getting updated :) with the code but not on Salesforce. Does the code need to be updated to pass Salesforce ID into parameters as well? This form is for Person Accounts
    – Reva
    Commented Sep 5, 2023 at 23:03

You must log in to answer this question.

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