Creating a new record type
To enable a custom Appian application to interact with the ABBYY FlexiCapture Connector for Appian, you will need to create the entities described below. Prior to creating these entities, make sure that the ABBYYFlexiCapturePlugin.jar plug-in is installed on the Appian server. To install the plug-in on the Appian server, simply copy it from the connector distribution package into this folder: APPIAN_INSTALL/_admin/plugins/. Now you need to:- 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.
- Create an AFC_GetDataTypeByRecordTypeName rule.
- Create a folder of type “Knowledge Center” where to store processed files received from ABBYY FlexiCapture.
- Create a Web API method for adding a new document into the knowledge center.
- Create a Record Web API method for populating the database table.
Creating an AFC_GetConstantDSEByRecordTypeName rule that will return a constant of type “Data Store Entity”
The CreateRecord method of the Web API requires a rule that returns constant of type “Data Store Entity.” This rule will determine the data store and data type where a record should be created.- In Appian Designer, open the application and click New → Expression Rule.
- Select Create from scratch, complete the Name and Save In fields, and click Create & Edit.
- In the Rule Inputs dialog box, click the + icon and create a new input variable of type “Text” and name it “RecordTypeName”.
- Paste the following code into the code editor on the left:
Creating an AFC_GetDataTypeByRecordTypeName rule that will return the full name of the data type
The CreateRecord method of the Web API requires a rule that returns the full name of the data type.- In Appian Designer, open the application and click New → Expression Rule.
- Select Create from scratch, complete the Name and Save In fields, and click Create & Edit.
- In the Rule Inputs dialog box, click the + icon and create a new input variable of type “Text” and name it “RecordTypeName”.
- Paste the following code into the code editor on the left:
Creating a Web API method for adding a new document to the knowledge center
- In Appian Designer, open the application and click New → Web API.
- Enter “UploadDocument” (without the quotes) into the Name and Endpoint fields. Change HTTP Method to POST and click Create & Edit.
- Close the template selection dialog box and paste the following code into the code editor:
The uploaddocument(String query) method will be displayed in the code editor only if there is a ABBYYFlexiCapturePlugin.jar file in APPIAN_INSTALL/_admin/plugins/. This method sends a JSON string with the file contents directly to the JAVA method you created and gets back a JSON string with the ID of the folder where the document was placed.
Creating a Web API method for populating the database table
- In Appian Designer, open the application and click New → Web API.
- Enter “CreateRecord” (without the quotes) into the Name and Endpoint fields. Change HTTP Method to POST and click Create & Edit.
- Close the template selection dialog box and paste the following code into the code editor:
- The rule!AFC_GetDataTypeByRecordTypeName(http!request.queryParameters.RecordTypeName) rule will accept as input a parameter with the name of the record type (received by the Web API method from the ABBYY FlexiCapture Connector for Appian) and return the full name of the data type.
- The rule!AFC_GetConstantDSEByRecordTypeName(http!request.queryParameters.RecordTypeName) will return the Data Store Entity constant.
- In the right-hand pane, click the New Query Parameter button and add a new parameter named RecordTypeName into the query string. Finally, select the Set as default test value option and click Save.
