As seen in this question Programmatically get navigation case <to-view-id> from faces-config.xml by outcome i use getNavigationCase to get my view id based on the outcome, and in my case also on the fromAction.
FacesContext context = FacesContext.getCurrentInstance();
ConfigurableNavigationHandler configNavHandler = (ConfigurableNavigationHandler) context.getApplication()
.getNavigationHandler();
NavigationCase navCase = configNavHandler.getNavigationCase(context, fromAction, outcome);
The problem is no navigation case is found, even if i have a navigation case matching perfectly fromAction and outcome
<navigation-rule>
<from-view-id>/jsp/example/exampleSource.xhtml</from-view-id>
<navigation-case>
<from-outcome>loadSuccess</from-outcome>
<to-view-id>/jsp/example/exampleDetails.xhtml</to-view-id>
</navigation-case>
...
</navigation-rule>
It happens only with the navigation rules with a from-view-id field. The simpler ones work. Example:
<navigation-case>
<from-outcome>GOTO_SEARCH</from-outcome>
<to-view-id>/jsp/search.xhtml</to-view-id>
</navigation-case>