Extract part of a string in Adobe Campaign | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

Amit_Kumar
Level 10
July 18, 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

Marcel_Szimonisz
Community Advisor
Community Advisor
July 20, 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