Order Management > Add the Subprocess to the Main Process > Step 2: Add the Subprocess to each Parallel Path
  

Step 2: Add the Subprocess to each Parallel Path

Add the Send Email process to both branches. The first branch sends an email to the consumer. The second branch sends an email to the vendor.
    1Click and drag a Subprocess step onto the first branch.
    The step properties section appears.
    2Select the Process tab and select the Send Email process.
    3Select the Input Fields tab and add the following fields:
    Field Name
    Field Type
    Field Value
    EmailAddress
    Content
    testconsumer@mailinator.com
    Message
    Formula
    fn:concat ("Dear ", $input.CustomerName, ". Thanks for ordering.", "Your order ID is: ", $output.OrderId, ". We will deliver your order in 7 days.")
    You use the XQuery concat() function to build the email message.
    Note: Click f(x) to open the Expression Editor and view the XQuery expression that you entered.
    The image shows the Expression Editor with the Concat XQuery expression you entered.
    4Select the General tab and enter Send Email to Consumer in the Name field.
    5Click and drag a Subprocess step onto the second branch.
    The step properties section appears.
    6Select the Process tab and select the Send Email process.
    7Select the Input Fields tab and add the following fields:
    Field Name
    Field Type
    Field Value
    EmailAddress
    Content
    testvendor@mailinator.com
    Message
    Formula
    fn:concat ("Order has been accepted. The order ID is: ",$output.OrderId, ". Please note below details for your records.", " Overall Profit: ", $output.Calculate_Margin_ServiceResponse[1]/MarginBeforeCommission ,". SalesCommission: ",$output.Calculate_Margin_ServiceResponse[1]/SalesCommission,". Profit after Commission: ", $output.Calculate_Margin_ServiceResponse[1]/MarginAfterCommission )
    Note: Click f(x) to open the Expression Editor and view the XQuery expression that you entered.
    The image shows the Expression Editor with the Concat XQuery expression you entered.
    8Select the General tab and enter Send Email to Vendor in the Name field.
    9Click Save > Publish
The following image shows the process canvas:
This image shows the Order Management process with the Send Email subprocess added.