Skip to main content
Michael Lazarevic (NTT Data) a posé une question dans #Omnistudio

I'm in an org using Omnistudio managed package, which means my LWCs do not have the ability to extend NavigationMixin, which would allow the use of OmniNextStep() 

 

According to

https://help.salesforce.com/s/articleView?id=xcloud.os_create_and_map_data_inside_the_custom_lwc_element.htm&type=5

 

 

it appears the only thing I am able to do is bubble an event to pass data. My LWC has a button, and the result of that button has data get bubbled up via an event. 

 

I would like my Omniscript to navigate to the next available step (Or a specific one if necessary) but do not know how to do that. Is it possible? Why would the managed package not give us the ability to let a standalone lwc navigate us to any extent? 

 

#Omnistudio  #Vlocity  #LWC

1 réponse
  1. 6 oct., 10:07

    Hi Michael, 

     

    You don't need NavigationMixin — you need OmniscriptBaseMixin, which is purpose-built for exactly this (works with the managed package too). Your Custom LWC should import and extend it; that gives you omniNextStep(), omniPrevStep(), and omniNavigateTo(step) directly, no event bubbling required. 

     

    ```js 

    import { OmniscriptBaseMixin } from 'vlocity_cmt/omniscriptBaseMixin'; // or your org's namespace 

     

    export default class MyCustomLwc extends OmniscriptBaseMixin(LightningElement) { 

        nextButton(evt) { 

            this.omniNextStep(); 

        } 

     

        goToStep(evt) { 

            this.omniNavigateTo(this.omniScriptHeaderDef.asIndex + 1); // or a step element name as a string 

        } 

    } 

    ``` 

     

    Notes: 

    - omniNavigateTo(step) accepts either a numeric step index or a step's element name as a string. 

    - You can't auto-advance more than one step ahead with omniNavigateTo — it's restricted to adjacent navigation for state-integrity reasons. 

    - The same mixin also gives you methods to read/update the OmniScript's data JSON directly from your component, so you likely don't need the event-bubbling approach at all for data passing either — that's really meant for parent-to-child communication patterns, not LWC-to-OmniScript control. 

     

    To your "why doesn't the managed package allow it" question: it does — this isn't a restriction, it's just that NavigationMixin (the generic Salesforce page-navigation API) was never the right tool here. OmniscriptBaseMixin is the namespaced, OmniStudio-specific equivalent that handles step navigation plus data sync, which NavigationMixin was never designed to do. 

     

    Reference:

    https://help.salesforce.com/s/articleView?id=xcloud.os_extend_the_omniscriptbasemixin_component_17717.htm&language=en_US&type=5

0/9000