Expand my Community achievements bar.

We are excited to introduce our latest innovation to enhance the Adobe Campaign user experience — the Adobe Campaign v8 Web User Interface!
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

12 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

Avatar

Level 2

Hello Manoj,

 

I have set the value of document.controller.setValue('/ctx/vars/response','NO'); in the configuration. In the subsequent script within the web application, I am storing this response value in a variable and passing it to the schema. However, the ctx.vars.response variable is storing an empty value.

Is there any other approach to achieve this?

 

Best regards,
Ankita Vishe

Avatar

Community Advisor

Hello @AnkitaV3131 

 

Replace this code

var resp=ctx.vars.response

with

var resp=document.controller.getValue('/ctx/vars/response');

     Manoj
     Find me on LinkedIn

Avatar

Level 2

Hello Manoj,

 

I was able to view the ctx.vars.Response value using the alert, but I'm facing difficulty fetching the ctx.vars.Response value in the next script activity. When I attempt to retrieve the value in the script, it appears blank. I need to store this value in the schema, as shown in the attached snapshot.

 

Regards,
Ankita Vishe

Avatar

Level 6

Hello @AnkitaV3131,

 

Try with 

var Resp = ctx.vars.Response.toString();

 

Br,

Amine

Avatar

Level 2

Hi Amine,

Thanks for your response!

I have tried in this way too but still not able to fetch the value and insert.

Regards,
ankita

Avatar

Level 2

Also previously i have created multiple landing pages and used the same syntax to fetch the value and it was working fine.But don't know why I am facing the issues with this web app.

Avatar

Community Advisor

Hello @AnkitaV3131 

 

Can you please check if this variable is defined in the Web applicaiton Properties?


     Manoj
     Find me on LinkedIn