Free cookie consent management tool by TermsFeed Using IDP in a Subprocess [Intelligent Document Processing v1.7]
Using IDP in a Subprocess
Google has deprecated legacy versions of AutoML services, which directly impacts IDP's core functionality.

Additionally, the IDP application was deprecated with Appian 23.2. Customers who wish to use the application will need to refactor plug-ins using AutoML.

Introduction

Many organizations manage documents as part of a larger workflow. Intelligent Document Processing (IDP) has been designed in such a way that it's easy to incorporate into larger workflows. You can use IDP in a subprocess to synchronously process one document, asynchronously process one or multiple documents, or asynchronously process a zip file with multiple documents. This page provides guidance for invoking IDP in a subprocess. If you want to use IDP directly in the IDP site, refer to the Intelligent Document Processing User Guide. If you want to invoke IDP from an external system, refer to Using IDP with External Systems.

Synchronously Process One Document

If you are an Appian developer incorporating IDP into a larger workflow that cannot continue without receiving the document data, then you may invoke IDP to synchronously process one document.

In your parent process model:

  1. Create a process variable of type DU_DocUnderstanding to correspond with the IDP output variable. You may name the variable docUnderstanding.
  2. Add a Subprocess node from the palette onto the canvas and use the connectors to incorporate it into the workflow.
  3. Place the subprocess node in a Run as whoever designed this process model lane (create one if it does not already exist) or click the Assignment tab and select Run as whoever designed the process model.
  4. On the Setup tab of the subprocess node:
    • For The subprocess will run, select Synchronously.
      • Note: The subprocess will run synchronously until a job GUID is generated, at which point it will run asynchronously. It is necessary for the parent process to have the job GUID variable populated since it is used to look up the status of the job and to get the extracted document data for the job.
    • For Run this process model, click on the Directory to select the DU Upload Docs for Understanding process model.
    • Select the document process variable you wish to process for the documents input variable.
    • If the document type is known, you can input the document type ID for the docTypeId input variable. The document type ID can be found in the dudoctype table in the database.
    • Add an output variable. Select the process variable you created in step 1 and map it to the docUnderstanding output process variable.
      • Note: You may also create a Boolean process variable to correspond with the output variable forwereInvalidDocsUploaded to determine whether subsequent nodes should execute.
  5. Click OK.

If you are processing a document that could be one of multiple document types, you can use pv!docUnderstanding.doctypeId to determine the next steps for each document type once the subprocess completes. To retrieve the document data, you can use this expression, which will output the document CDT that corresponds to the document type.

1
2
3
rule!DU_getDataForUnderstandingId(
  understandingId: pv!docUnderstanding.understandingId
)

You should receive an output similar to the following:

1
2
3
4
5
6
7
'type!{urn:com:appian:types:DU}DU_Invoice'(
  id: 39,
  invoiceNumber: "INV-12",
  invoiceDate: "Oct 09, 2019",
  total: "$17600.00",
  supplier: "Acme Corporation"
)

If you want the person who performs the document reconciliation to complete a subsequent task in the parent process, you may use activity-chaining so they are immediately routed to this task.

You may refer to the process model DU Synchronous Parent Process Example as an example. You can also duplicate the process model and modify it to suit your use case.

Asynchronously Process One or Multiple Documents

If you are an Appian developer incorporating IDP into a larger workflow that can continue without receiving the document data, then you may invoke IDP to asynchronously process the documents.

In your parent process model:

  1. Create a process variable of type Text to correspond with the IDP job GUID output variable. You may name the variable jobGuid.
  2. Add a Subprocess node from the palette onto the canvas and use the connectors to incorporate it into the workflow.
  3. On the Setup tab of the subprocess node:
    • For The subprocess will run, select Synchronously.
    • For Run this process model, click on the Directory to select the DU Upload Docs for Understanding process model.
    • Select the document or document array process variable you wish to process for the documents input variable OR select the zip document process variable for the zipFile process variable (if both input variables are populated, only the documents in the ZIP file will be processed).
    • If the document type is known, you can input the document type ID for the docTypeId input variable. The document type ID can be found in the dudoctype table in the database.
    • Add an output variable. Select the process variable you created in step 1 and map it to the jobGuid output process variable.
      • Note: You may also create a Boolean process variable to correspond with the output variable forwereInvalidDocsUploaded to determine whether subsequent nodes should execute.
  4. Click OK.

You can check on the status using the expression below to check on the status of the job.

1
2
3
rule!DU_isJobDoneForJobGuid(
  jobGuid: pv!docUnderstanding.jobGuid
)

Once the expression returns true, you may use the expression below to retrieve the document data.

1
2
3
rule!DU_getDataForJobGuid(
  jobGuid: pv!docUnderstanding.jobGuid
)

You should receive a List of Dictionary similar to the following:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
{
  {
    understandingId: 1353,
    documentId: 6230,
    documentName: "InvoiceINV-12",
    docTypeId: 1,
    docTypeName: "Invoice",
    entityId: 39,
    data: {
      invoiceNumber: "INV-12",
      invoiceDate: "Oct 09, 2019",
      total: "$17600.00",
      supplier: "Acme Corporation"
    }
  },
  {
    understandingId: 1354,
    documentId: 6231,
    documentName: "Wayne Enterprises Purchase Order",
    docTypeId: 2,
    docTypeName: "Purchase Order",
    entityId: 19,
    data: {
      poNumber: "6545",
      issueDate: "07/19/2018",
      purchaser: "Wayne Enterprises",
      total: "$1,350.00"
    }
  }
}

If you want to use this information directly in the process model, you can use the expression above to retrieve the metadata and map to a list of DU_DocumentMetaData.

You should receive an output similar to the following:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{
  {
    understandingId: 1353,
    documentId: 6230,
    documentName: "InvoiceINV-12",
    docTypeId: 1,
    docTypeName: "Invoice",
    entityId: 39
  },
  {
    understandingId: 1354,
    documentId: 6231,
    documentName: "Wayne Enterprises Purchase Order",
    docTypeId: 2,
    docTypeName: "Purchase Order",
    entityId: 19
  }
}

And you can use the following expression to map to a list of your document type CDT such as a list of DU_Invoice.

1
2
3
rule!DU_getDataForJobGuid(
  jobGuid: pv!jobGuid
).data

As an example, for invoices, you should receive a list of DU_Invoice similar to the following:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{
  {
    id: 39,
    invoiceNumber: "INV-12",
    invoiceDate: "Oct 09, 2019",
    total: "$17600.00",
    supplier: "Acme Corporation"
  },
  {
    id: 19,
    poNumber: "6545",
    issueDate: "07/19/2018",
    purchaser: "Wayne Enterprises",
    total: "$1,350.00"
  }
}

The DU Upload Docs for Understanding was designed to avoid synchronously processing multiple documents to prevent load on the execution engines. If multiple documents or a zip file is passed in as a subprocess input variable and isAsync is set to false() or null(), IDP will still process the documents asynchronously.

You may refer to the process model DU Asynchronous Parent Process Example as an example. You can also duplicate the process model and modify it to suit your use case.

Open in Github Built: Fri, Nov 10, 2023 (03:42:48 PM)

Using IDP in a Subprocess

FEEDBACK