Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards
SOLVED

Passing Web app URL variable value to the context variable

Avatar

Level 2
Level 2

Hi Team,

Actually there is dynamic web app for the subscription ill be creating to So that i supposed to pass the value in the ending of the web app URL 

For Eg:https://sandbox.adobe-campaign.com/webApp/APP400?jurisdiction=SWUSL

So based on the value i ll be doing the condition in query def and fetch the data to display in the web app 

Now i want to pass the SWUSL (jurisdiction value or what ever the jurisdiction value is passing through web app URL) to the context variable and i can make condition.

Can anyone help on this?

Feel free to do the follow up for the clarification.

 

1 Accepted Solution

Avatar

Correct answer by
Level 4

Hi @VV7,

If I understood correctly you can follow the below steps.

  1. Define the Parameter in Web App Properties. - Select Local variable or Context variable (e.g., ctx.vars.jurisdiction) ( Check Mandatory)
  2. Access the Parameter in a Script Activity -
    1. Add a Script activity before the page or query activity in your web app workflow.
    2. Use JavaScript to retrieve the URL parameter and store it in the context variable. For example:
var jurisdiction = ctx.vars.jurisdiction;
logInfo("Jurisdiction value: " + jurisdiction);​

if the parameter is not automatically mapped, you can manually parse the URL parameter

var jurisdiction = getUrlParameter('jurisdiction'); // Custom function to extract URL parameter
ctx.vars.jurisdiction = jurisdiction; // Store in context variable

Note: The getUrlParameter function is not built-in, so you may need to implement it or rely on Adobe Campaign’s parameter mapping.

 

Use the Context Variable in QueryDef:

In a Query activity, use the context variable in the queryDef to filter data based on the jurisdiction value. For example:

<queryDef schema="nms:recipient" operation="select">
  <select>
    <node expr="@email"/>
    <node expr="@firstName"/>
  </select>
  <where>
    <condition expr={"[recipient/@jurisdiction] = '" + ctx.vars.jurisdiction + "'"}/>
  </where>
</queryDef>

This query filters recipients where the jurisdiction field matches the value from the URL (e.g., SWUSL).

Start → Script (set ctx.vars.jurisdiction from URL) → Query (use ctx.vars.jurisdiction in queryDef) → Page (display results) → End.


https://experienceleaguecommunities.adobe.com/t5/adobe-campaign-classic-questions/push-parameter-val...

Thanks
Sushant Trimukhe

View solution in original post

2 Replies

Avatar

Correct answer by
Level 4

Hi @VV7,

If I understood correctly you can follow the below steps.

  1. Define the Parameter in Web App Properties. - Select Local variable or Context variable (e.g., ctx.vars.jurisdiction) ( Check Mandatory)
  2. Access the Parameter in a Script Activity -
    1. Add a Script activity before the page or query activity in your web app workflow.
    2. Use JavaScript to retrieve the URL parameter and store it in the context variable. For example:
var jurisdiction = ctx.vars.jurisdiction;
logInfo("Jurisdiction value: " + jurisdiction);​

if the parameter is not automatically mapped, you can manually parse the URL parameter

var jurisdiction = getUrlParameter('jurisdiction'); // Custom function to extract URL parameter
ctx.vars.jurisdiction = jurisdiction; // Store in context variable

Note: The getUrlParameter function is not built-in, so you may need to implement it or rely on Adobe Campaign’s parameter mapping.

 

Use the Context Variable in QueryDef:

In a Query activity, use the context variable in the queryDef to filter data based on the jurisdiction value. For example:

<queryDef schema="nms:recipient" operation="select">
  <select>
    <node expr="@email"/>
    <node expr="@firstName"/>
  </select>
  <where>
    <condition expr={"[recipient/@jurisdiction] = '" + ctx.vars.jurisdiction + "'"}/>
  </where>
</queryDef>

This query filters recipients where the jurisdiction field matches the value from the URL (e.g., SWUSL).

Start → Script (set ctx.vars.jurisdiction from URL) → Query (use ctx.vars.jurisdiction in queryDef) → Page (display results) → End.


https://experienceleaguecommunities.adobe.com/t5/adobe-campaign-classic-questions/push-parameter-val...

Thanks
Sushant Trimukhe

Avatar

Level 2
Level 2

Hi @SushantTrimukheD ,

Actually this one worked well for me 

var jurisdiction = getUrlParameter('jurisdiction'); // Custom function to extract URL parameter
ctx.vars.jurisdiction = jurisdiction; // Store in context variable

And as this getUrlParameter not a default function i have defined it explicitly and its worked

Thanks for it.