Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

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

Avatar

Level 1

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.

5 Replies

Avatar

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 %>

Avatar

Level 1

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.

 

Avatar

Level 1

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');
%>