---
schema_version: "1"
id: 7ed656025e0dc77e85f8313eb94afd4b689a01630cee2ba6af32a40c68a6045a
title: Clear a Saved State from a Previous Step (Managed Package)
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/xcloud/264-0-0/os_clearing_a_saved_state_from_a_previous_step.md
canonical_url: https://help.salesforce.com/s/articleView?id=xcloud.os_clearing_a_saved_state_from_a_previous_step.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: cea768cee4939958c252d3a7eeb1f9d0194ab74c99655cfeaa37526058b560ec
description: For the managed package runtime, beginning with Vlocity Insurance and Health Winter '20 , when a Custom LWC's saved state relies on data from a previous step, you can conditionally clear the saved state of the Custom LWC whenever a user navigates to a previous step. After configuration, the Step element passes a boolean flag to the custom LWC. The code in your Custom LWC must use the boolean to determine whether to instantiate a new saved state or continue using the existing saved state.
products:
  - Omnistudio
release: "264"
---
# Clear a Saved State from a Previous Step (Managed Package)

For the managed package runtime, beginning with Vlocity Insurance and Health Winter '20 , when a Custom LWC's saved state relies on data from a previous step, you can conditionally clear the saved state of the Custom LWC whenever a user navigates to a previous step. After configuration, the Step element passes a boolean flag to the custom LWC. The code in your Custom LWC must use the boolean to determine whether to instantiate a new saved state or continue using the existing saved state.

![Managed Package app icon](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio_for_managed_packages-264-0-0-production-enus/aa2554ec-624a-4ee6-8da4-6435670e6e62/resources-global/_corporate/images/managedpackageicon.png) This information is for Omnistudio for Managed Packages. For Omnistudio on standard runtime, see [Omnistudio Help](https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_standard.htm&language=en_US).

To configure the clear saved state functionality:

1. In Omniscript, determine the Step that clears the Custom LWCs saved state.
2. In the Step's properties, click **Edit as JSON**.
3. Enter the property `"omniClearSaveState": [ ]`.
4. In the **omniClearSaveState** property, enter the name of one or more custom LWC elements `"omniClearSaveState": [ "CustomLWC1"]`. The Step sends data to the Custom LWC enabling the Custom LWC to determine if the Step rendered.
5. In your Custom LWC's code, retrieve the current state.
    
    ```
    const state = this.omniGetSaveState() 
    ```
6. In your Custom LWC's code, set a variable equal to `this.omniGetSaveState(this.omniJsonDef.name + '-$Vlocity.cleared'`. The function evaluates whether the previous Step containing the omniClearSaveState property rendered and returns a boolean.
    
    ```
    let stateCleared = this.omniGetSaveState(this.omniJsonDef.name + '-$Vlocity.cleared');
                   
    ```
7. Modify your code by using the boolean value to determine whether to keep the current saved state or instantiate a new saved state.