--- title: "Configure post-processing of lines" slug: "configure-post-processing-of-lines" description: "Configure a specific Apex class to be able to add data to the imported lines in the same way you would add data when using the Add Lines component. " updated: 2023-10-04T09:53:06Z published: 2023-10-04T09:53:06Z canonical: "docs.zilliant.com/configure-post-processing-of-lines" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.zilliant.com/llms.txt > Use this file to discover all available pages before exploring further. # Configure post-processing of lines When using the CSV component to import lines into Deal Manager, you can register a **zpl.CsvImportAddLinesPostProcessor** class. This class is a ready-to-use Deal Manager implementation of the post-processor Apex class. It allows executing IQA calls for lines uploaded through a **CSV import** component in exactly the same way as they would be executed when using the **Add Lines** component. In this way, you can add data—such as cost, price guidance, and metric calculations—to imported lines. Note You can configure post-processing only for lines imported into Salesforce. ## Configure post-processing of lines 1. Follow [these steps](/v1/docs/configure-csv-import-component) to configure the **CSV Import** component, but when you reach step 4, do the following: - **Workflow Automation ID**—Enter the **Automation ID** of the job workflow that contains the **Load to Salesforce** job step. - **External Bulk Data Job Id Logical Entity Field**—Enter the system name of the logical entity field in which the identifier of the **External Bulk Data Job** should be automatically written during the import. Deal Manager entities already contain the **ExternalBulkDataJobId** field, which you can specify here. For other entities, you can create a new field of the text type. - **Workflow Custom Post Processor Class**—Enter **zpl.CsvImportAddLinesPostProcessor**. - **Workflow Custom Post Processor Parameters**—Enter the following parameters in the JSON format: - **sObjectName**—Required. The API name of the sObject where the records will be imported. - **externalBulkDataJobIdFieldName**—Required. The API name of the **External Bulk Data Job Id** field on the specified sObject (the same field you specified in the **External Bulk Data Job Id Logical Entity Field** field of the CSV Import component configuration). - **productSelectorConfigName**—Required if the **iqaConfigName** parameter is not used, otherwise optional. The unique nickname of the Product Selector Configuration for which **Line Items Creation Configurer** and/or **Line Items Evaluation Post Processor** Apex hooks should be executed. Note A hook is executed if it is registered in the appropriate **Product Selector Configuration**. - **iqaConfigName**—Required if the **productSelectorConfigName** parameter is not used, otherwise optional. The name of the IQ Anywhere configuration based on which IQA should be called for post-processed lines. - **batchSize**—Optional. Batch size of the Apex batch job that will execute IQA or Apex hooks. If you do not add this parameter, the default value of 200 is used. ### Parameters Examples of valid parameters you can specify in the **Workflow Custom Post Processor Parameters** field: ``` {"sObjectName":"zpl__ContractLineItem__c","externalBulkDataJobIdFieldName":"zpl__ExternalBulkDataJobId__c","iqaConfigName":""} ``` ``` {"sObjectName":"zpl__ContractLineItem__c","externalBulkDataJobIdFieldName":"zpl__ExternalBulkDataJobId__c","productSelectorConfigName":"","batchSize":"500"} ``` ``` {"sObjectName":"zpl__ContractLineItem__c","externalBulkDataJobIdFieldName":"zpl__ExternalBulkDataJobId__c","iqaConfigName":"","productSelectorConfigName":"","batchSize":"50"} ``` ### General considerations - The logic of the **zpl.CsvImportAddLinesPostProcessor** class is executed only if the Job Workflow is successful. - If any errors occur during the IQA execution, the post-processing won't fail, but the error message will be written in the **zpl__Error__c** field (or other error field defined in the IQ Anywhere configuration) for the affected lines. - If you use both **productSelectorConfigName** and **iqaConfigName** parameters, the order of execution is: - Execution of the **Line Items Creation Configurer** Apex hook (if defined). - Execution of IQA for the returned from that hook lines. - Execution of the **Line Items Evaluation Post Processor** Apex hook (if defined). - Persistence (insertion or update) of lines returned from the last hook (or from IQA if the hook is not defined). - If you use both **productSelectorConfigName** and **iqaConfigName** parameters, do not perform any DML operations (insert, update, delete) in the **Line Items Creation Configure** Apex hook. Instead, use the **Line Items Evaluation Post Processor** Apex hook for them. - If you use only the **productSelectorConfigName** parameter, you can perform any DML operations in the **Line Items Creation Configurer** Apex hook. The **Line Items Evaluation Post Processor** Apex hook won't be executed in this case because it is executed only in combination with IQA. - The **zpl.CsvImportAddLinesPostProcessor** uses Apex batch job to call Apex hooks and IQA. If there is not enough space in the Apex Flex Queue to submit a new Apex batch job, the post-processor cancels or postpones its execution by throwing the **zpf.CsvImportCancelPostProcessingException**. After that, a user can manually retry or cancel post-processing. If a user cancels post-processing, the uploaded records are deleted and the import's status is set to **Failed**. 1. In the **Upload SRS Mapping**: - Define mapping to the field specified in the **External Bulk Data Job Id Logical Entity Field** field above. - Define a filter to upload lines only from the current import (replace **'your entity field name'** with the **External Bulk Data Job Id Logical Entity Field** name): ``` { "filterName": "Filter by External Bulk Data Job Id", "filterExpression":"'your entity field name' eq '[ExternalBulkDataJobId]'" } ``` #### Optionally configure an Apex hook If you are using the **CSV import** component for any other purpose than importing lines into Deal Manager, you can register a custom Apex class to execute any post-processing logic for the uploaded lines. [Learn how](/v1/docs/csvimportpostprocessordata).