I have a global footer in the marketing cloud and there I put a unsubscribe link in which I created a site.come page and passed AccoundID. So my updated requirement is, I need to pass LeadID too there. I am using two data extension one for Account and other for Lead. So whenever leadID would be there, LeadID should be worked and in other case AccoundID should be worked. my unsubscribe link is as follows https://google.com?Id=%%AccountID%%LeadID&EmaiId=%%PersonEmail%%">Unsubscribe /> When I am passing both IDs and getting one of the only ID lets say I am getting only AccountID, it's giving me an error LeadID was not found. So is there any way in which I can use both IDs in the link and the Id I am getting whether it is of Account as well as Lead, It should work. Thanks

  • You need to have attributes named AccountID and LeadID in the Data Extension you are sending too. So either you add both IDs to the Data Extension you are sending too. Or you use one of the Lookup functions in AMPScript. developer.salesforce.com/docs/… – user3274635 Aug 12 '19 at 7:22

Pass the ID as a general ID of the record that wants to unsubscribe, regardless which one this is, instead of two separate IDs, and then use the following to determine which object this is and which table should be updated:

SET @Id = [retrieve Id passed as parameter]
        / Check if it’s a Lead or Account/
        IF Substring(@subscriber_key, 1,3) == "00Q" THEN
            / it’s a Lead /
            SET @UpdateLead = [use an Update function to update your DE with Leads]
            / it’s an Account /
            SET @UpdateAccount = [use an Update function to update your DE with Accounts]                                      


Based on new details provided, this should work:

SET @AccountID = [retrieve Account ID]
SET @LeadID = [retrieve Lead ID]
SET @email = emailaddr
Set @link = "http://site.com"

    SET @url = concat(@link,"?Id=",@AccountID,"&EmaiId=",@email)
    SET @url = concat(@link,"?Id=",@LeadID,"&EmaiId=",@email)

<a href="%%=RedirectTo(@url)=%%">Unsubscribe</a>

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.