Add Code to Display a Saved Search as a Table Not Created As a Visualization

If you didn't create the table as a visualization, use these steps to add the code to display a table from a saved search.

Important: The code in this example is for opportunities. For value to use with other objects, see the topic Values to Use in Code for Standard Components in Tables, Metric Cards, and List Views.
  1. On the Components palette, in the Filter field, enter cx-subview.

  2. Drag and drop the cx-subview fragment to the template editor, between the template tags.

    This screenshot illustrates how to drag a fragment to the template editor.

  3. Add the following class information: class="oj-flex oracle-cx-fragmentsUI-cx-fragment-full-height" to the <oj-vb-fragment line before the > tag.

    <oj-vb-fragment bridge="[[vbBridge]]" name="oracle_cx_fragmentsUI:cx-subview"
        class="oj-flex oracle-cx-fragmentsUI-cx-fragment-full-height">
  4. Add the required resource parameter, which specifies the business object you're displaying. Each object requires different values. Here are the values for opportunities:

    <oj-vb-fragment-param name="resource"
          value='[[ {"name": "opportunities", "primaryKey": "OptyId", "puid": "OptyNumber", "endpoint": "cx" } ]]'>
        </oj-vb-fragment-param>

    The values for other business objects are listed in the topic Values to Use in Code for Standard Components in Tables, Metric Cards, and List Views.

  5. If you're displaying a table with opportunity revenue, you must insert this additional parameter because opportunity revenue is a child object of opportunity:

    <oj-vb-fragment-param name="child" value='[[ {"name": "ChildRevenue", "primaryKey": "RevnId"} ]]'></oj-vb-fragment-param>
  6. Add the required query parameter, which specifies the saved search that is the source of the data in your table:

     <oj-vb-fragment-param name="query" value='[[ [{"type": "savedSearch", "params": [{"key": "queryUuid", "value": "caf84b9d-b975-4b9d-b78e-41718b78f36e" }]}
         ] ]]'></oj-vb-fragment-param>

    In this example, the source is a saved search with the ID caf84b9d-b975-4b9d-b78e-41718b78f36e. You can obtain the ID of saved searches by inspecting the code in the Chrome browser as described the topic How can I find the UUIDs for a saved search and the IDs for its filters in Oracle Sales in the Redwood User Experience?.

  7. Optionally, you can filter the data from your source. For example, the sample parameters here filter the data to include only open opportunities owned by a manager's subordinates.

      <oj-vb-fragment-param name="query" value='[[ [{"type": "savedSearch", "params": [{"key": "queryUuid", "value": "caf84b9d-b975-4b9d-b78e-41718b78f36e"}]},
                                                      {"type": "qbe", "params": [{"key": "StatusCode", "operator": "in", "value": ["OPEN"] },
                                                                                {"key": "RecordSet", "value": "ORA_MYSUBORDSSALESTEAMOPTIES" }]},
                                                      ] ]]'></oj-vb-fragment-param>
  8. Add the following style parameter. It specifies the size and position of the sections in the tab as you add more sections. For details see the topic How Information Displays in a Sales Dashboard Tab as You Add Sections

       <oj-vb-fragment-param name="style" value="[[ 'dashboard' ]]"></oj-vb-fragment-param>
  9. Add the subviewLayoutId parameter to use the dashboard layout (dashboardLayout). The dashboard layout specifies which columns are displayed in the table, in which order, and in which relative widths. The default layout already includes the important columns, but you can create your own custom layouts as described in the topic: Specify the Columns in a Sales Dashboard Table and Their Widths

     <oj-vb-fragment-param name="subviewLayoutId" value="[[ 'dashboardLayout' ]]"></oj-vb-fragment-param>
  10. Add the title parameter, to specify the title that displays on the tab.

    <oj-vb-fragment-param name="title" value="[['Hardware Opportunities]]"></oj-vb-fragment-param>

Sample Code for Opportunity Pipeline Table from a Saved Search

Here's the complete code for an opportunity table (leaving out the optional query parameters):


<template id="hardwareOpportunitiesInPipeline">
  <oj-vb-fragment bridge="[[vbBridge]]" name="oracle_cx_fragmentsUI:cx-subview"
    class="oj-flex oracle-cx-fragmentsUI-cx-fragment-full-height">
    <oj-vb-fragment-param name="resource"
      value='[[ {"name": "opportunities", "primaryKey": "OptyId", "puid": "OptyNumber", "endpoint": "cx" } ]]'>
    </oj-vb-fragment-param>
    <oj-vb-fragment-param name="query" value='[[ [{"type": "savedSearch", "params": [{"key": "queryUuid", "value": "caf84b9d-b975-4b9d-b78e-41718b78f36e" }]}
     ] ]]'></oj-vb-fragment-param>
    <oj-vb-fragment-param name="style" value="[[ 'dashboard' ]]"></oj-vb-fragment-param>
    <oj-vb-fragment-param name="title" value="[['Hardware Opportunities']]"></oj-vb-fragment-param>
    <oj-vb-fragment-param name="subviewLayoutId" value="[[ 'dashboardLayout' ]]"></oj-vb-fragment-param>
  </oj-vb-fragment>
</template>

Sample Code for a Table with Opportunity Revenue

To add a table of opportunity revenue, you must add an additional revenue parameter because a revenue line is a child object of opportunity:

<oj-vb-fragment-param name="child" value='[[ {"name": "ChildRevenue", "primaryKey": "RevnId"} ]]'></oj-vb-fragment-param>

Here is sample code with the child fragment added:

<template id="revenueTable">
<oj-vb-fragment name="oracle_cx_fragmentsUI:cx-subview" class="oj-flex oracle-cx-fragmentsUI-cx-fragment-full-height" bridge="[[ vbBridge ]]">
    <oj-vb-fragment-param name="resource" value='[[ {"name": "opportunities", "primaryKey": "OptyId", "puid": "OptyNumber", "endpoint": "cx" } ]]'></oj-vb-fragment-param>
    <oj-vb-fragment-param name="child" value='[[ {"name": "ChildRevenue", "primaryKey": "RevnId"} ]]'></oj-vb-fragment-param>
    <oj-vb-fragment-param name="query" value='[[ [{"type": "savedSearch", "params": [{"key": "queryUuid", "value": "73b21b33-db08-4327-bf30-88c3c9e0f70d" }]}] ]]'></oj-vb-fragment-param>
    <oj-vb-fragment-param name="style" value="[[ 'dashboard' ]]"></oj-vb-fragment-param>
    <oj-vb-fragment-param name="title" value="[['Revenue']]"></oj-vb-fragment-param>    
    <oj-vb-fragment-param name="subviewLayoutId" value="[[ 'dashboardLayout' ]]"></oj-vb-fragment-param>
  </oj-vb-fragment>
</template>