List Action in Integration Procedure ?
List Action is a part of the Integration Procedure that allows merging, sorting, and modifying multiple lists of items.
Properties of List Action:
1. List Merge
2. Sort List
3. Modify List

  1. List Merge

    • Merge List in an Integration Procedure refers to the process of combining two or more separate lists into a single, unified list. This can be useful in integration procedures when you need to combine data from multiple sources into a single list.
    • In MERGE LIST ORDER value fields we have to add the list name, the order depends on which list value should have the priority to override the value of a given field in a list.

      Example 1: Simple Merge


    • Merge Fields value field without checking the Advance Merge checkbox, expects a field on the bases of which the merging of the list would happen. eg: “id”



      Using the above configuration and the following Input the response shows that the 2 list got merged based on the “id” field.



    • Example 2: Has Primary

      For this example we will use the same list as in the above example, only think is we will check the Has Primary checkbox and in the Primary List Key field we will add a list, which will be our primary list, so when we merge the list we will only get nodes/objects from the primary list and not add any node that doesn’t have a matching key from a non primary list.

      In the following screen shot we can see the response doesn’t have the node with “id” 4, as it was coming from Orders2 list which is not the primary list, in our case Orders1 is the primary list and only nodes from that list will be returned.




    • Example 3: Advance Merge with One Key

      For this feature we will have to check the Advance Merge checkbox. We use Advance Merge when we want to merge list based on some key but the key name are different in different list.
      ex: Order.id = OrderItem.orderId.

      For this example we will use Orders2 list and OrderItems and the configuration as follows.
      In the Advance Merge Map the List Key field expects a list and Matching Path expects the key from the list in List Key and Matching Group is a way to configure the group we will be matching based on.



      So the Matching Group for both the entries are 1 as they are part of the same group (id).

      The full configuration of the List Action .


      The Input and Response




    • Example 4: Advance Merge With Two Keys

      For this example we will merge lists based on 2 fields “id” and “type”.
      ex: Order.id = OrderItem.orderId AND Order.type = OrderItem.itemType

      So the configuration is very similar to the Example 3, we will only add 2 more entries to Advance Merge Map for type matching.



      Input and Response



      The response we can see that the object with “orderId” 2 is not merged as the “itemType” did not match with “type” from the orders list.

  2. Sort List

    • This is used to arrange the list in some order based on some field like alphabetical, numerical, or date order.
    • Sorting a list can be useful in integration procedures to ensure that the data being integrated is organized and consistent.
    • The default will display the response as ASCENDING order.

    • Example 5: We will use the exact same configuration as above just sort the response base on the “orderName” field.





  3. Modify List

    • We can add remove and modify list objects with this action.

      Example 6: Dynamic Output Fields can be used to only return the fields as required.

      For this example we will pass an input “required_fields” which will pass a string with comma separated field names “orderName,orderId,itemName,itemType,itemId“.






    • Example 7: Filter List Formula

      Filter formula that we can use to filter the List ex:- using the above example we can use “itemType == “mobile” in the Filter List Formula to filter the list to only return the nodes that have “itemType” as “mobile“.






      Resources:
      1. Video: https://youtu.be/6lwYg_sRRfo
      2.DataPack: https://github.com/TenByZenn/OmniStudio-Examples/blob/main/IntegrationProcedureExamples/IP_LIST_ACTION_EXAMPLE.json

Leave a Reply

Your email address will not be published. Required fields are marked *

Recent Posts

Categories