Extract part of a string in Adobe Campaign

Avatar

Avatar

chloechen1995

Avatar

chloechen1995

chloechen1995

17-07-2017

Hi!

Can someone please give me some suggestions on how to extract part of the url, which is 3444444 in this case from this url http://abc.com/&q=2q42&ctype=ids&cval=3444444&ttag  using the adobe campaign functions?

Thanks!

Replies

Avatar

Avatar

Amit_Kumar

MVP

Avatar

Amit_Kumar

MVP

Amit_Kumar
MVP

17-07-2017

Hi Chloe,

It's quite simple, If you are using this in webapp then you have two options

1. use parameters available in web app under properties.

2. use this in your script this.webApp.request.getParameter("cval");

if you are using a jssp page or java script templates or codes use below

request.getParameter("cval");

Regards,

Amit

Avatar

Avatar

MarcelSzimonisz

MVP

Avatar

MarcelSzimonisz

MVP

MarcelSzimonisz
MVP

20-07-2017

Helo @chloechen1995

If you cannot use the above (in the webApp) you might use e.g.

// "http://domain.com?par1=pp&par2=ff"

var url = "http://abc.com?q=2q42&ctype=ids&cval=3444444&ttag";

String.prototype.getParameter = function(param){

  if(this.split("?").length != 2)

    return false;  

  for each(var qp in this.split("?")[1].split("&")){

    if (qp.split("=").length==2)

      if(qp.split("=")[0] == param)

        return qp.split("=")[1];

  }

  return false;

}

logInfo(url.getParameter("cval")); // >>> 3444444

Marcel