0

On Sales cloud we have Contract records containing a checkbox. When this checkbox is checked, a Journey fires in Marketing Cloud. This journey will send an email to the email associated with the contract. In the email there will be a personalized button routing the user to a Cloud page.

enter image description here

The issue at hand is that I cannot get the data from the Journey Data Extension onto the cloud page.

The code is as follows:

<script runat="server">
Platform.Load("Core","1.1.1");
try{
</script>
%%[
    VAR @contractId, @personContactId, @personFirstName, @personLastName
    SET @contractId = AttributeValue("Contract:Id")
    SET @personContactId = AttributeValue("Contract:Recipient_Account__r:PersonContactId")
    SET @personFirstName = AttributeValue("Contract:Recipient_Account__r:FirstName")
    SET @personLastName = AttributeValue("Contract:Recipient_Account__r:LastName")
]%%

<h1> 
@contractId: %%=v(@contractId)=%%, 
@personContactId: %%=v(@personContactId)=%%
@personFirstName: %%=v(@personFirstName)=%%, 
@personLastName: %%=v(@personLastName)=%% 
</h1>



<script runat="server">
}
catch(e) {
 Variable.SetValue("errorMessage", Stringify(e.message) + Stringify(e.description));
}
</script>
 
<script runat="client">
console.log(`@contractId: %%=v(@contractId)=%%`);
console.log(`@personContactId: %%=v(@personContactId)=%%`);
console.log(`@personFirstName: %%=v(@personFirstName)=%%`);
console.log(`@personLastName: %%=v(@personLastName)=%%`);
</script>

But these values come up empty in the HTML and console. I have done this before in a previous project, and found 1 more question regarding this, but for some reason I cannot figure out what I am missing.

Anyone any clue what to try or what I am doing wrong?

1 Answer 1

0

Apparently the issue was in the way button was configured to route the user to the Cloudpage. Our consultant initially configured it, so that it would link to a "Secure Website (https://)" with the url of the form directly inputted as Link URL.

I'm not sure whether that normally works at all, as I don't touch this part much, but the way I solved it was using %%=CloudPagesURL(123,'ContractId',Contract:Id)=%%, and then retrieve it using: SET @contractId = QueryParameter('ContractId') on the Cloudpage.

Weirdly, despite only the ContractId being explicitly defined in the url this way, all the other fields were suddenly being retrieved as well. This did not happen if I only used %%=CloudPagesURL(123)=%%, so I still feel I'm missing something. However it works, and if anyone else runs into this issue, check this part is configured correctly.

You must log in to answer this question.

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