In Oracle Visual Builder Studio, how do I show a different layout for different values of a field in a parent object?

View the following video on Oracle Cloud Customer Connect to learn how to display different layouts on a child object, such as a revenue line, when a value in the parent object, such as an opportunity, changes in Oracle Sales in the Redwood User Experience. For example, you can display different fields on the Edit Opportunity Revenue Lines page, depending on which sales method is selected in the opportunity: Parent Record Condition on Child Dynamic Layout

Here's some of the sample code provided in the video:

  • Revenue items JavaScript

    define(["vx/oracle_cx_fragmentsUI/ui/self/resources/js/utils/contextHelper"], 
    (ContextHelper) => {'use strict';
    class LayoutModule {getSalesMethodId(){const pageContext =ContextHelper.getPageContext();
    const row = pageContext.row;return row['SalesMethodId'];}}
    return LayoutModule;});
    
  • Gruntfile.js

    'use strict';
    /**
    •	Visual Builder project build script.
    •	For details about the application build and Visual Builder-specific grunt tasks
    •	provided by the grunt-vb-build npm dependency, please refer to
    •	//configure required modules bundling "vb-require-bundle": { options: { 
    transpile: false, minify:true, emptypaths: [ 
    "vx/oracle_cx_fragmentsUI/ui/self/resources/js/utils/contextHelper", 
    "vx/oracle_cx_fragmentsUI/ui/self/resources/js/utils/actionstHelper", 
    "vx/oracle_cx_fragmentsUI/ui/self/resources/js/utils/callbackHelper", ], }, 
    },});};
    
  • Condition on layout using the custom method

    $functions.getSalesMethodId() == '300000005048554'