Add the CreatedBy and LastUpdatedBy Fields to Notes Panels and Subviews

Users can add notes to a record, and those notes will display on a Notes panel as well as on a Notes subview page. As an administrator, you can optionally display the CreatedBy and LastUpdatedBy fields for each note. If you add either of these fields to a Note layout, then you must use a specific field template so that the user names display correctly at runtime. This topic illustrates how to add the correct field template.

In this example, we'll add the LastUpdatedBy field to the Notes panel and subview that display on a Payment record. You can follow the same set of steps if you want to display the CreatedBy field, as well.

Update the Field Templates File

In the field templates file, add a new field template.

  1. In Visual Builder Studio, click the Source side tab.

  2. On the Source side tab, navigate to extension1 > sources > dynamicLayouts > self > field-templates-overlay.html.

  3. In the field-templates-overlay.html file, add this field template:

    <template id="userNameTemplate">
    <oj-vb-fragment name="oracle_cx_fragmentsUI:cx-profile" bridge="[[ vbBridge ]]">
    <oj-vb-fragment-param name="user" value="[[ { 'userName' : $value() } ]]"></oj-vb-fragment-param>
    </oj-vb-fragment>
    </template>

Add the LastUpdatedBy Field to the Panel

Add the LastUpdatedBy field to the Notes panel that displays on a Payment record.

  1. In Visual Builder Studio, click the Layouts side tab.

  2. On the Layouts side tab, click the Payment_c > Note node.

  3. Click the Rule Sets subtab.

  4. Click the Panel Card Layout rule set.

  5. Click the Open icon to edit the default layout.

    This screenshot illustrates how to open the default layout.

  6. Select the field, LastUpdatedBy, from the field list and drag to the desired location on the panel layout.

    This screenshot illustrates how to select a field to display on a layout.

  7. Associate the LastedUpdatedBy field with the userNameTemplate field template:

    1. On the Note tab, click the JSON subtab.

    2. In the "PanelCardLayout" section, add a "fieldTemplateMap" section with a row for the LastedUpdatedBy field:

      ,
            "fieldTemplateMap": {
              "LastUpdatedBy": "userNameTemplate"
            }

      The resulting JSON will look like this:

      This screenshot illustrates the placement of the new field template section.

Add the LastUpdatedBy Field to the Subview

  1. Switch to the Sub View Layout rule set.

    This screenshot illustrates how to switch rule sets.

  2. Click the Open icon to edit the default layout.

  3. Select the field, LastUpdatedBy, from the field list, and drag to the desired location on the subview layout.

    For example, drag the field to the item2 slot.

    This screenshot illustrates the item2 slot.

  4. Associate the LastedUpdatedBy field with the userNameTemplate field template:

    1. On the Note tab, click the JSON subtab.

    2. In the "SubViewLayout" section, update the existing "fieldTemplateMap" section with a row for the LastedUpdatedBy field:

      ,
            "fieldTemplateMap": {
              "NoteTxt": "noteTemplate",
              "LastUpdatedBy": "userNameTemplate"
            }

Test the Flow

You can now test the Notes panel and subview to confirm that they both display the name of the person who last updated the note.

  1. From the payment_c-list page, click the Preview button to see your changes in your runtime test environment.

    This is a screenshot of the Preview button in Visual Builder Studio.
  2. The resulting preview link will be:

    https://<servername>/fscmUI/redwood/cx-custom/payment_c/payment_c-list

  3. Change the preview link as follows:

    https://<servername>/fscmUI/redwood/cx-custom/application/container/payment_c/payment_c-list

    Note: You must add /application/container to the preview link.

    The screenshot below illustrates what the list page looks like with data.

    This is a screenshot of the test list page.

  4. Click any existing payment to view its detail page.

  5. In the Action Bar, enter Create Note.

  6. Click Create Note.

    The Create Note drawer displays.

  7. Create a note and then click Create.

  8. On the Notes panel, you should see the newly created note, along with the full user name, not the ID, of the person who last updated the note.

  9. Click View All Notes to view the Notes subview.

    The subview should also display the full user name, not the ID, of the person who last updated the note.

    This screenshot illustrates the correctly displayed user name on the note.

  10. Save your work by using the Push Git command.

    Navigate to the Git tab, review your changes, and do a Git push (which does both a commit and a push to the Git repository).

    This screenshot illustrates how to use the Push Git command.