---
sourceDocument: Yokohama Finance and Supply Chain
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/yokohama/source-to-pay-operations

 Release :

    - yokohama

ft:locale :

    - en-US

ft:publication_title :

    - Yokohama Finance and Supply Chain

ft:clusterId :

    - stpop

bundleId :

    - stpop

workflow :

    - Employee


---

# Create subflow in workflow studio

# Create subflow in workflow studio {#ariaid-title1}

* Release version: Yokohama
* 
* Updated January 30, 2025
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 2 minutes to read

Use subflows to configure conditions that are applied on the invoice and raise an exception.

## Before you begin

Role required: admin

This video shows you how to create subflow in workflow studio.

## Procedure

1. Navigate to Workflow StudioNewSubflows.  
   The subflow page appears.
2. Enter the Subflow name.
3. Enter the Description.
4. Choose the Application as Accounts Payable Invoice Processing in the drop-down list.
5. Click Build subflow.
6. Configure Inputs and Outputs for Subflow.  
   Example: In Subflows, you must fetch the invoice record based on sys_id. Traverse through the invoice record and check if the condition business owner or legal entity is empty. If the condition matches, then the system raises an exception.
   1. In the Inputs area, enter Label as invoice Sysids.
   2. Enter Name as invoice_sysids.
   3. The Type drop-down is auto-populated with String.
   4. Select Done.
   5. In the header area, click Flow variables.  
      The Flow variables pop-up appears.
   6. Enter Label as Condition result.
   7. Enter Name as Condition result.
   8. Choose Type as True/False.
   9. Select Save.
   {#create-subflow-in-workflow-studio__substeps_g2c_snf_gbc}
7. In Actions area, perform the following steps:
   1. Select Action as Look Up Records from the drop-down list.
   2. In the Table field, search forinvoice \[sn_shop_invoice\].
   3. Configure the Conditions as sys_id is one of invoice SysIDs.
   4. In Actions \> Accounts Payable Invoice Processing \> Look Up Records.
   5. Select Table as Invoice \[sn_shop_invoice\]
   6. Set the ConditionsSysIDis one ofSubflows- Inputsinvoice Sysids.
   7. Select Done.
   8. Create Flow logicFor Each item inLook Up RecordsInvoice Records \> Done.
   9. Select IfCondition1For EachInvoice RecordBusiness owneris empty.
   10. Select IfCondition2For EachInvoice RecordLegal entityis empty.
   11. Select then \> ![]() icon.
   12. Click Done.
   13. Add a flow logic as Set Flow variable.
   14. Choose Condition result from the drop-down list.
   15. Select the Data check-box.
   16. Select Done.
   17. Add a Flow logic as Set Flow variables.
   18. Choose Condition result from the drop-down list.
   19. Select Done.
   20. Select Save.
   21. Choose ActionAccounts Payable Invoice ProcessingGenerate Exception and Line Exceptions from the drop-down list.
   22. Choose Condition result as Flow Variable.
   23. Choose Exception Definition Record as Missing BO or LegalEntity.
   24. Choose the Invoice as For Each \> Invoice record.
   25. Enter the description.
   26. Select Done.
   27. Select Save.  
       Success message appears as the subflow is saved successfully.
   {#create-subflow-in-workflow-studio__substeps_lxq_qpf_gbc}
8. Select Publish.  
   You are prompted with an alert message "Are you sure you want to publish this subflow? Your changes will be applied to all instances where this subflow is being used."

## Result

The subflow is successfully created.

*[\>]: and then


