Skip to main content

Configuring Custom Fields Using Lightning Flow

Summary

After you configure SAP Component Custom Field Groups and SAP Component Custom Fields using Custom Metadata Types, you need to configure those groups of custom fields that you want to display by creating and configuring a new customized flow.

  • The following process is an example of how to configure a flow to display a group of custom fields for the SAP Customer Details component.
  • You must repeat this process for each SAP Component Custom Field Group that's configured for each flow that displays that respective component.

Some steps will vary based on your specific custom configuration needs.

You must follow different steps depending on which custom field groups you want to display:

  • All components within the SAP Customer Details Flow

OR

  • All components within the SAP Sales Document Detail Flow

Configure Custom Fields for the SAP Customer Details Flow

Includes the following components:

  • SAP Customer Details (provided in the steps listed below)
  • SAP Customer Company (follow similar steps as for the SAP Customer Details listed below)
  • SAP Customer Sales Areas (follow similar steps as for the SAP Customer Details listed below)

Create a Flow Variable

  • Go to Setup.
  • Use the Setup Quick Find box to search for "Flows", then click the Flows link (under Process Automation). The Setup Flows page displays.

  • Click on the SAP Customer Details flow label link. The Flow Builder displays.

  • Click the Manager tab in the left-hand navigation pane, then click the New Resource button.

Create a Record Variable for the Preset

  • Follow these steps to create a record variable for the preset:

    • Select Variable from the Resource Type drop-down.
    • Enter "SelectedPreset" in the API Name text box.
    • Select Record from the Data Type drop-down.
    • Enter and select "SAP Component Custom Field Group" (ensxapp__SAP_Component_Custom_Field_Group__mdt) in the Object field.
    • You can enter a resource description in the Description text box.
    • Leave the Available for input and Available for output checkboxes unchecked.

  • Click the Done button. Now you'll see SelectedPreset listed under Record (Single) Variables in the left-hand navigation pane.

  • Click the Elements tab in the left-hand navigation pane.

Populate the Flow Variable Using Get Records

  • Click on the connecting line between Start and SAP Customer Details.

  • When the line turns blue, press the Delete key to remove it.

  • Drag the Get Records data element onto the screen between Start and SAP Customer Details.

  • Enter "Get Field Preset" in the Label text box.

  • Follow these steps to configure which records to get for this object:
    • Enter and select "SAP Component Custom Field Group" in the Object field.
    • Select All Conditions are Met (AND) in the Condition Requirements drop-down.
    • Enter and select "DeveloperName" (Custom Metadata Record Name) for Field.
    • Select Equals from the Operator drop-down.
    • Enter the SAP Component Custom Field Group Name that is configured under Custom Metadata Types / SAP Component Custom Field Group (example: Customer_Detail_Fields) in the Value field.

  • Select Not Sorted from the Sort Order drop-down.
  • Select Only the first record for the How Many Records to Store field.
  • Select Automatically store all fields for the How to Store Record Data field.

  • Click the Done button.

Configure Screen Interaction to use the Flow Variable to Display Custom Fields for a Component

  • Double-click on the SAP Customer Details screen icon.

  • Select the SAP Customer Detail component.

  • Enter "SelectedPreset" in the Custom Field Presets field.
  • Expand the submenu (see the following screenshot).

  • Select "Id" (Custom Metadata Record ID).
  • Now the Custom Field Presets field displays {!SelectedPreset.Id}.

  • Click the Done button.

Connect the Flow Steps

  1. Draw a connector from the Start element to the Get Field Preset element.
  2. Draw a connector from the Get Field Preset element to the SAP Customer Details element.

Save and Activate the New Flow

  • Click the Save As button.

  • Enter a new name for your flow in the Label field.

  • Click the Save button.

  • Click the Activate button.
  • Congratulations! Your new flow with custom fields is now active!

Configure Custom Fields for the SAP Sales Document Details Flow

Includes the following components:

  • SAP Delivery Detail (provided in the steps listed below)
  • SAP Invoice Detail (follow similar steps as for the SAP Delivery Detail listed below)
  • SAP Sales Doc Detail Header (follow similar steps as for the SAP Delivery Detail listed below)

You don't need to create flow variables or add Get Records elements to the flow.

Configure the screens within the SAP Sales Document Details flow

  • Go to Setup.
  • Use the Setup Quick Find box to search for "Flows", then click the Flows link (under Process Automation). The Setup Flows page displays.

  • Click on the SAP Sales Document Details flow label link. The Flow Builder displays.
  • Double-click on the SAP Delivery Detail screen icon.

  • Select the SAP Delivery Detail element.
  • Enter the API name for the metadata SAP Component Custom Field Group you created for Delivery Detail.

  • Click the Done button.
    • Repeat these steps for each detail component that you want to display custom field groups for.

Save and Activate new Flow

  1. Click the Save As button.
  2. Enter a new name for your flow in the Label field.
  3. Click the Save button.
  4. Click the Activate button.
  5. Congratulations! Your new flow with custom fields is now active for the document detail pages!

Override default flow with new flow for Lightning components on the Account Detail Page

  • Click on "App Launcher"
  • Select an App (example: Sales).
  • Go to the Accounts tab and select an Account.
  • Click the Setup cog icon, then click Edit Page.
  • Click on the SAP Delivery Search component.
  • Enter the API name for the new flow in the flow override field.
    • This tells the system which flow to reference when you click on a delivery document that is returned in the delivery search component.

  • Click the Save button (activate if needed).
  • Congratulations! Now your Lightning components will display custom fields when you view the details of a delivery document.
    • Repeat these steps for each component that you configured custom fields for in a new flow.