Before you create these entities, make sure the
ABBYYFlexiCapturePlugin.jar plugin is installed on the Appian server. To install it, copy the plugin from the connector distribution package into the APPIAN_INSTALL/_admin/plugins/ folder.- Create a data type.
- Create a data source.
- Create a data store.
- Create a record type.
- Create a constant of type Data Store Entity to link the data store to the data type.
- Create an AFC_GetConstantDSEByRecordTypeName rule that returns a constant of type Data Store Entity.
- Create an AFC_GetDataTypeByRecordTypeName rule that returns the full name of the data type.
- Create a folder of type Knowledge Center to store the processed files received from ABBYY FlexiCapture.
- Create the UploadDocument Web API method to add a new document to the knowledge center.
- Create the CreateRecord Web API method to populate the database table.
Create an AFC_GetConstantDSEByRecordTypeName rule
TheCreateRecord method of the Web API requires a rule that returns a constant of type Data Store Entity. This rule determines the data store and data type where a record is created.
1
Create a new expression rule
In Appian Designer, open the application and click New → Expression Rule.
2
Name and save the rule
Select Create from scratch, complete the Name and Save In fields, and click Create & Edit.
3
Add the RecordTypeName input
In the Rule Inputs dialog box, click the + icon and add an input variable of type Text named
RecordTypeName.4
Paste the expression
In the code editor on the left, paste the following expression:
RecordTypeName input matches the name of a stored record type (in the plural), the rule returns the Data Store Entity constant that links the data store and the data type.
Create an AFC_GetDataTypeByRecordTypeName rule
TheCreateRecord method of the Web API requires a rule that returns the full name of the data type.
1
Create a new expression rule
In Appian Designer, open the application and click New → Expression Rule.
2
Name and save the rule
Select Create from scratch, complete the Name and Save In fields, and click Create & Edit.
3
Add the RecordTypeName input
In the Rule Inputs dialog box, click the + icon and add an input variable of type Text named
RecordTypeName.4
Paste the expression
In the code editor on the left, paste the following expression:
RecordTypeName input matches the name of a stored record type (in the plural), the rule returns a string with the full name of the data type. Otherwise, it returns null. To find the namespace, open the data type in the ABBYYFlexiCapture application, and then click the name of the data type in the top-left corner to open the Data Type Properties window.
Create the UploadDocument Web API method
1
Create a new Web API
In Appian Designer, open the application and click New → Web API.
2
Name the Web API
Enter
UploadDocument in the Name and Endpoint fields, change HTTP Method to POST, and click Create & Edit.3
Paste the code
Close the template selection dialog box, and then paste the following code into the code editor:
The
uploaddocument(String query) method appears in the code editor only if the ABBYYFlexiCapturePlugin.jar file is in the APPIAN_INSTALL/_admin/plugins/ folder. This method sends a JSON string with the file contents directly to the Java method you created and returns a JSON string with the ID of the folder where the document was placed.Create the CreateRecord Web API method
1
Create a new Web API
In Appian Designer, open the application and click New → Web API.
2
Name the Web API
Enter
CreateRecord in the Name and Endpoint fields, change HTTP Method to POST, and click Create & Edit.3
Paste the code
Close the template selection dialog box, and then paste the following code into the code editor:
rule!AFC_GetDataTypeByRecordTypeName(http!request.queryParameters.RecordTypeName)accepts a parameter with the name of the record type (received by the Web API method from the ABBYY FlexiCapture Connector for Appian) and returns the full name of the data type.rule!AFC_GetConstantDSEByRecordTypeName(http!request.queryParameters.RecordTypeName)returns the Data Store Entity constant.
4
Add the query parameter
- In the right-hand pane, click the New Query Parameter button and add a parameter named
RecordTypeNameto the query string. - Select the Set as default test value option and click Save.
