AnsweredAssumed Answered

URL in dictionary returns 404 Not Found

Question asked by Frank Oprel on May 9, 2019
Latest reply on May 10, 2019 by Frank Oprel

I have created velocity script to render multiple downloads in one email. The idea is simple: a form contains a string field that's given the field type 'Checkboxes'; This field is appended with the values of each download that a person requests. In the script below, the string field is split into a list and checked against a dictionary (not sure if I'm using the right term here). However, the URL in dictionary returns a 404 error. I assume it's an escaping issue. But I don't have enough experience with Velocity's syntax to solve it.

 

#set( $category = "cyber" )  
#set( $downloads = { 
  "cyber" : {
     "cyber-security-learning" : {
         "url" : "https://view.example.nl/rs/834-ESS-180/images/Cyber-Security Brochure.pdf",
        "button" : "Cyber Security Learing"
        },
     "cisa-certification" : {
         "url" : "https://view.example.nl/rs/834-ESS-180/images/CISA-Certification Brochure.pdf",
        "button": "CISA Certification"
        },
     "cism-certification" : {
         "url" : "https://view.example.nl/rs/834-ESS-180/images/CISM-Certification Brochure.pdf",
        "button" : "CISM Certification"
         }
  } 
} )

#set ( $mktoList = ${lead.aCBrochures} )
#set ( $courses = $mktoList.split("; ") )

<ul>
#foreach ( $course in $courses )
  #if ( $downloads[$category].containsKey(${course}) )
       <li><a href="${downloads[$category][${course}]["url"]}">${downloads[$category][$course]["button"]}</a></li>
  #end
#end
</ul>

 

Link path Marketo is trying to link to looks something like this:

 

http://view2.example.nl/dc/$mktEncrypt.encrypt($mkturl1)/uE0000wS4w0v0L03q7NESL0

 

Hope someone is able to help me out.

Outcomes