0

I am using CloudPageURL to pass a couple of DE attributes along with a Constant variable and have them populate in a Cloudpage Smartcapture field that is hidden.

Below is my code in the email

<a href="%%=CloudPagesURL(3036,'id',[Id],'accountid',[ICP External],'nps', "0")=%%" target="_blank"><img class="survey-table" data-assetid="260729" src="button.png"></a>

[Id] & [ICP External] are DE attributes whereas 'nps' has a constant value of 0 that i want to pass.

Below is my code in the Cloud page

%%[
var @id, @nps, @accountid
set @id = RequestParameter('id')
set @nps = RequestParameter('nps')
set @accountid = RequestParameter('accountid')
]%%

<input name="Id" type="hidden" value="%%=v(@id)=%%">
<input name="accountid" type="hidden" value="%%=v(@accountid)=%%">
<input name="nps_rating" type="hidden" value="%%=v(@nps)=%%">

It works when i only pass DE attributes but says 'Bad request' if i include the 'nps' variable. What am i doing wrong here. Is it possible to pass a constant variable using CloudPagesURL along with attributes from the sendable DE?

Your help here is appreciated.

1
  • 1
    its the double quotes around the value "0" change it to '0'
    – EazyE
    Nov 17, 2020 at 2:31

2 Answers 2

3

Try this - in your email, set all parameters as variables:

%%[
set @id = [Id]
set @accountid = [ICP External]
set @nps = "0"
]%%

And pass the variables in your CloudPagesURL function:

CloudPagesURL(3036,'id',@id,'accountid',@accountid,'nps',@nps)

Not sure why you are passing the nps value since it’s hardcoded to be 0 - if it’s not going to change, then I would just skip it and hardcode it inside the CloudPage. In that case do just:

CloudPagesURL(3036,'id',@id,'accountid',@accountid)

If you’re using WAC/Parameter Management to add additional parameters to your links at send time, you will have to wrap your CloudPagesURL function in a RedirectTo function:

RedirectTo(CloudPagesURL(3036,'id',@id,'accountid',@accountid))

EDIT

Turns out passing the value of 0 is a problem, so try to avoid it if possible.

5
  • Ill give this one a go. The 0 relates to the linked button in the email which will tell me the score is 0. There will be 9 other buttons which will have different respective values. ill try this and revert.
    – Rahul
    Nov 17, 2020 at 19:32
  • 1
    The zero might be tricky, so maybe try with a string or a different number if it’s up to you to name them?
    – zuzannamj
    Nov 17, 2020 at 19:33
  • So I have been trying a few things. You are right the 0 is a problem. When i put in another numerical it works. Now, i have changed the data field type to number in the receiving DE but magically for no reason the SmartCapture Submit button simply reloads the page instead of redirecting to the thankyou url. I need to fix this to check whether my data type setting was the reason 0 wasnt coming through. Would there be any reason for the Smartcapture submit button to not redirect? it was working this morning when i was testing and now it doesnt.
    – Rahul
    Nov 18, 2020 at 0:24
  • So it turns out passing 0 as a constant is a problem. Any other number get passed as normal.
    – Rahul
    Nov 18, 2020 at 1:51
  • Yep, just try a different naming convention for your buttons and you should be good
    – zuzannamj
    Nov 18, 2020 at 8:51
1

Try this

%%[
  
  Set @LPID = 3036
  var @id, @accountid
  
  set @id = concat('id=', [id])
  set @accountid = concat('&accountid=', [ICP External])

  Set @UTMParameters = concat(@id, @accountid, '&nps=0')
]%%

<a href="%%=RedirectTo(Concat(CloudPagesURL(@LPID), @UTMParameters ))=%%" target="_blank"><img class="survey-table" data-assetid="260729" src="button.png"></a>
4
  • working on it...
    – Rahul
    Nov 17, 2020 at 1:14
  • So changing to single quotes passes the [Id] but not the 'nps' & using Leto's solution passes the 'nps' but not the [Id]. the code in the cloud page is this. i have removed the [accountid] to keep it simple. %%[ var @nps, @id set @nps = RequestParameter('nps') set @id = RequestParameter('id') ]%% <input name="nps_rating" type="hidden" value="%%=v(@nps)=%%"><input name="Id" type="hidden" value="%%=v(@id)=%%"><input name="accountid" type="hidden" value=""></form></td></tr></table>
    – Rahul
    Nov 17, 2020 at 2:52
  • I am just going to send as a string and this seems to have worked. i was hoping for encryption which would have been ideal. %%[var @id, @link0, set @id=[Id] set @link0=Concat("url?nps=0&campaign=Onboarding &id=",@id)
    – Rahul
    Nov 17, 2020 at 3:30
  • 1
    @RahulG it will be encrypted if you use the CloudPagesURL function. See my answer for a simple solution.
    – zuzannamj
    Nov 17, 2020 at 16:33

You must log in to answer this question.

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