I have a process set-up where people can confirm they have received a message via A Cloudpage. If they open the Cloudpage a field in Salesforce is updated saying they have confirmed. On the object in Salesforce the view_email_url is added as well. The issue is that people who have access to Salesforce can also access the view_email_url and can therefore also confirm the message. This is a problem, because only the contact who originally received the email should be able to confirm this message. I need to find a way that people who access the view_email_url via Salesforce can’t confirm this message.
What I've done so far is append an additional query string to the view_email_url in SF, now my goal is to execute AMPscript on the view_email_url page to prevent people from clicking a link if they have the URL with the additional query string. I can't seem to call the string via queryparameter function. I've tried SSJS as well, but can't find a function to execute on the view_email_url page only
So i've tried this:
%%[
SET @CurrentURL = RequestParameter('PAGEURL')
]%%
And this:
<script runat="server">
Platform.Load("core", "1.1.1");
var currentUrl = Platform.Request.RequestURL;
</script>
But these all seem to execute on the MC side.
Any suggestions?
EDIT:
This is how It's currently set up, but this doesn't seem te work
URL for the view as webpage = www.urlgoeshere.com URL that will be displayed in Salesforce = www.urlgoeshere.com?value=SourceSF
SET @SourceSF = '&value=SourceSF'
SET @SFurl = CONCAT(@url, @SourceSF)
SET @Display = TreatAsContent(@SFurl)
The URL that will display to email recipients are created like:
SET @url = '%%view_email_url%%'
I'm pushing the SF URL using a createsalesforceobject function like so (along with some other values)
SET @result = CreateSalesforceObject("Messages__c",8,"ContactTo__c",@ContId,"URL_received_mail__c",@Display,"Name",@subjectline,
"Delivered_on_E_mail__c",emailaddr,"Status__c",'Send Confirmed',"Timestamp_Delivery__c",
@FinalDate, "Message_Type__c", "Essential Information", "Message__c", @message)
Then on the cloudpage I try to look at the parameter, but it doesn't seem to take into account the source of the View as Webpage (there is a difference between who views the VAWP: Email recipient, or Salesforce user).
SET @value = RequestParameter("Value")
IF @value != "SourceSF" THEN
UpdateSingleSalesforceObject("Messages__c",@BerichtID,"Confirmed__c",'True', "Date_Confirmed__c", @FinalDate)
ENDIF
This is not working and I can't think of a way this would work.
@url
should be equalview_email_url
not'%%view_email_url%%'
as that will just be written as a string and not pull in the actual url value. 2) theRequestParameter("Value")
is case sensitive I believe so it should be"value"
not"Value"
as the second will return null as the parameter being set in your code is&value=SourceSF
which is lowercase.