Expand my Community achievements bar.

Accelerate your Campaign learning with the Adobe Campaign Mentorship Program 2023!
SOLVED

How to carry data from one web app to another web app using a variable

Avatar

Level 2

I am looking to carry data in a variable from one web app to another web app in Campaign classic v7. I am getting a language choice selected by the user and I am calling a second web app URL in the end activity of first web app. I have to access that variable in the second app to make a workflow.

I am actually setting the value once user selects into the recipient.@language using the document.controller.setValue but the recipient will not be persisted until the flow goes into second app. 

So how can I set the value into variable from the recipient.@language in the first web app and how can I send/access it in the second web app using either recipient.@language or the variable.

Any pointers for the syntax or how can I use it?

I have tried using document.controller.getValue to read the recipient, but didnt work.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello @sirikambampati 

 

Create a variable in the webApp properties and name it as language.

 

In the first page set the value of language with document.controller.setValue('/ctx/vars/language','VALUE');

 

On the second page of the webApp you can get this value by using this syntax.

<%= ctx.vars.language %>

     Manoj
     Find me on LinkedIn

View solution in original post

5 Replies

Avatar

Correct answer by
Community Advisor

Hello @sirikambampati 

 

Create a variable in the webApp properties and name it as language.

 

In the first page set the value of language with document.controller.setValue('/ctx/vars/language','VALUE');

 

On the second page of the webApp you can get this value by using this syntax.

<%= ctx.vars.language %>

     Manoj
     Find me on LinkedIn

Avatar

Level 2

Hi @Manoj_Kumar_ 

 

Thanks for the reply.

 

 document.controller.setValue('/ctx/vars/language','VALUE'); this worked and I have updated my language variable in the java script function of HTML page.

But I have to carry my variable to another web app which I am calling in the END activity of one web app.

So basically I want to use a Global variable which I can set in first web app and it should be there in ctx after my flow navigates to another webapp where I can use the global variable.

 

How can I achieve this in Campaign classic, to set a global variable?

 

TIA.

 

 

 

Avatar

Community Advisor

Hello @sirikambampati 

 

The context variables are global to a webApp they can be accessed in any of the activities within the same webapp.

 


     Manoj
     Find me on LinkedIn

Avatar

Level 2

Hi @Manoj_Kumar_ 

 

Yes, thank you, I got that the ctx.var is a global variable with in any activity of same web app.

But I am looking to navigate to different web app from one, so how can I carry a variable?

Is that something possible in Campaign?

 

Thanks!

Avatar

Community Advisor

Hello @sirikambampati ,

 

There are 2 ways to do it.

 

1. Add your variable to the query parameters of the second webapp.

2. Use Options - Set options value in the first webapp and get its value in the second.

 

You can use this code to set and get the value of the options.

<%
setOption('VARIABLE','VARIABLE_VALUE');

getOption('VARIABLE');
%>

 


     Manoj
     Find me on LinkedIn