0

I would like to have "Add to Calendar" in the Email. My idea is to write the code to Javascript to generate file.ICS in CloudPage and link it with the button. When the Email receiver clicks on the button, the file.ICS will be downloaded.

enter image description here

I have a Journey Builder which is triggered from Sales Cloud. I have a CloudPage and I would like to retrieve the information of the "Date field" from the triggered record. I quite have no idea how to write the code to retrieve the "Date field" information in CloudPage. Below is the code that I have

    %%[
VAR @sid, @jid, @reason, @lue, @lue_prop, @lue_statusCode, @overallStatus, @requestId, @Response, @Status, @Error, @curEmail

SET @sid = AttributeValue("_subscriberkey")
SET @jid = AttributeValue("jobid")
SET @listid = AttributeValue("listid")
SET @batchid = AttributeValue("_jobsubscriberbatchid")
SET @reason = "One Click Unsubscribe"

VAR @subscriberRows,@result

SET @subscriberRows = RetrieveSalesforceObjects(
   "Contact",
   "AccountId, Email",
   "Id", "=", @sid )

if RowCount(@subscriberRows) == 1 then
  VAR @subscriberRow, @AccountId
  SET @subscriberRow = Row(@subscriberRows, 1)
  SET @AccountId = Field(@subscriberRow, "AccountId")
  SET @curEmail = Field(@subscriberRow, "Email")
endif

]%%
Ben Inm
  • 43
  • 6

1 Answers1

0

I would recommend using a parameter on the url. You can construct a url to use in your button using the CloudPagesUrl() function. It would look something like the below. You can continue to add params as you wish.

%%[
set @url  = CloudPagesUrl([YOURCLOUDPAGEID],'ParamNameToPass',@ParamValueToPass)
/* if needed */
set @url = URLEncode(@url)
]%%

NOTE: sometimes you will need to use URLEncode() so that the date is properly formatted in your url string. I usually would do that in the

and in the email, wrap the link in a RedirectTo():

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

and in the CloudPage (assuming it works like a microsite - please verify) use the RequestParameter() function and ask for the string value you used as the 'ParamNameToPass'

set @cloudPageVar = RequestParameter('ParamNameToPass')

Lastly, I highly recommend the function guide page on the dev site - it really helped me understand what was possible in AmpScript.

Sam P
  • 11
  • 4