> ## Documentation Index
> Fetch the complete documentation index at: https://moengage.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Why Does Dynamically Enabling or Disabling In-Apps Fail?

> Resolve issues with dynamically showing or hiding in-app messages in MoEngage using event-based or contextual in-app campaign strategies.

## Problem

There is a standard default method for showing the In-app campaigns, but you cannot dynamically control their visibility based on custom logic.

## Explanation

The custom logic that failed to hide the in-app messages dynamically involves initializing a Boolean value to true or false.

```ruby theme={null}
#val isInAppEnable = true
if(isEnable) {
showInApp()
}
val isInAppEnable = false
if(isEnable) {
showInApp()
}
```

## Solution

Perform one of the following steps:

* Use event-based In-apps to show or hide in-app messages based on your custom events on specific screens.
* Use contextual In-apps with specified screen names to toggle the visibility of in-app messages while working with multiple screens.
