Skip to main content
Level 1
April 2, 2026
Question

Hi Everyone, I'm having a use case where i should use a option variable to make the content on/off inside the webapplication how to do it??please help

  • April 2, 2026
  • 1 reply
  • 28 views

Hi Everyone, I'm having a use case where i should use a option variable to make the content on/off  inside the web application how to do it if option is 1 then banner should be visible 0 disappear

1 reply

Level 2
May 25, 2026

Hey GantaRa1,

You need two things: a Script activity to read the option into ctx, then a conditional block in your Page.

1-Script activity - to prepare the data before the Page

ctx.vars.displayBanner = getOption("cusWebAppShowContent");

2-In your Page HTML

<% if(ctx.vars.displayBanner == "1") { %>
<div class="banner">My Banner</div>
<% } %>

Main info: ctx is a shared XML variable across all activities of the Web App. Use it to store and manipulate data.

I wrote a more detailed article on how the `ctx` variable works in AC web apps, including how to use it for dynamic content, page transitions and client-side interactions: https://myrosblog.com/adobe-campaign/webapp

Hope this helps!

Button hidden when option is 0
Button displayed when option is 1
Debug mode activated, showing the value of the ctx variable