Velocity Script: Populating token output from a query string | Community
Skip to main content
Jason_Santo
Level 2
October 28, 2019
Solved

Velocity Script: Populating token output from a query string

  • October 28, 2019
  • 2 replies
  • 3296 views

Hi,


Very new to Velocity and have spent some time reading up on syntax, but I cannot seem to figure out something which seems simple: getting the ID query string out of a url formatted like this:

http://my.niftyurl.com/sub/company/blahblah.php?id=0000011&ST=QRS

The url is being pulled from a lead custom field (lead.rNSLink) and I'm successfully grabbing that. But I cannot figure out what to do with it to get the ID. I've tried things like "getParameter" and other Java functions, but nothing seems to quite fit the bill.


Help would be beyond appreciated.

Regards,

Jason

Best answer by SanfordWhiteman
#set( $rNSId = $link.uri($lead.rNSLink).getParams()["id"] )‍‍‍‍

I don't know which getParameter you were referring to, but the servlet one wouldn't apply here.

2 replies

SanfordWhiteman
Level 10
October 28, 2019

Please move the thread to Products‌. Move link will be at the right. "About" isn't a support space, it's for webmaster-type feedback.

Then we'll continue.

Jason_Santo
Level 2
October 28, 2019

Thank you for the rapid assist. I had no idea what any of the "Spaces" meant, so I appreciate being steered in the correct direction.

- Jason

SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
October 29, 2019
#set( $rNSId = $link.uri($lead.rNSLink).getParams()["id"] )‍‍‍‍

I don't know which getParameter you were referring to, but the servlet one wouldn't apply here.

Jason_Santo
Level 2
October 29, 2019

Hi Sanford.

Thanks for the answer on this. It worked fine. I realized that getParameter was for the servlet late in the game, but I didn't find 1) the syntax as you have it and 2) getParams. Clearly I need to look harder within uri documentation.

Be well,

Jason