Passing Web app URL variable value to the context variable | Community
Skip to main content
New Participant
July 1, 2025
Solved

Passing Web app URL variable value to the context variable

  • July 1, 2025
  • 1 reply
  • 622 views

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.

 

Best answer by SushantTrimukheD

Hi @vanivi1,

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-values-passed-in-a-url-of-a-webapp-to-a-workflow/td-p/617320

Thanks
Sushant Trimukhe

1 reply

SushantTrimukheD
SushantTrimukheDAccepted solution
New Participant
July 1, 2025

Hi @vanivi1,

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-values-passed-in-a-url-of-a-webapp-to-a-workflow/td-p/617320

Thanks
Sushant Trimukhe

VaniVi1Author
New Participant
July 1, 2025

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.