Import with Workflow
This section covers the procedure for running an import definition and starting a workflow process automatically at the end of the import.

In order to run a workflow process at the end of an import, or after each row is imported, you first need to create a Workflow Process. A Workflow Process consists of one or multiple Workflow Steps.

The Workflow Steps are created and managed through the “Project> Automation> Workflow Step” menu item. They are built using function builder, in the same way that script designer functions are built.

When used in conjunction with Imports, the following variables are available:
- [ROWID] This corresponds to the IDENTITY of the row just inserted when using the process after each row. If you are using the process after import is competed, then this is set to 0
- [IMPORTID] This corresponds to the ID of the import definition (pImportDefs.imp_ID column. [IMPORTNOTE] This corresponds to the note given by the user at the time of the import. When automated, this is set to the name of the file
- [IMPORTNAME] This corresponds to the name of the import definition (pImportDefs.imp_name column)
- [PROJECTID] This corresponds to the ID of the project (sProject.pro_ID column)
- [IMPORTFULLNOTE] This corresponds to the generated note inserted into pContacts (pContacts.Con_ImportID column)
- [IMPORTNAME]([IMPORTHISTORYID])–[IMPORTNOTE] o restricted to 50 chars
- [FILENAME] This corresponds to the filename of the imported file
- [JOBNAME] This is an automatically generated variable to be able to schedule a SQL job using SQL server agent o IMPORT_[IMPORTID]_P[PROJECTID]_yyyyMMddHHmmss

- The first line is used to generate the name of the list, and store it in a new [LISTNAME] variable.
- The second line is used to find a list with the same name and the same task type. The ID of this list will automatically be set in the [LISTID] variable.
- The third / fourth / fifth lines are used to create a new calls list if it was not found on the second line. The ID of the list created on the fourth line will automatically be set in the [LISTID].
- Finally, the last line is used to allocate the records to the calls list using the filter provided. Please note that the filter will include all records in the imported file. If you wish to filter out some of the records (for example to exclude DNC records), please make sure that you amend the filter.

- The first line is used to generate the name of the list, and store it in a new [LISTNAME] variable.
- The second line is used to find a list on the server with the same name and the same campaign/team. The ID of this list will automatically be set in the [LISTID] variable.
- The third / fourth / fifth lines are used to create a new calls list if it was not found on the second line. The ID of the list created on the fourth line will automatically be set in the [LISTID].
-
Finally, the last line is used to allocate the records to the calls list using the filter provided. Please note that the filter will include all records in the imported file. If you wish to filter out some of the records (for example to exclude DNC records), please make sure that you amend the filter.
Alternatively the following function can be used:

The Workflow Process is created and managed through the “Project> Automation> Workflow Process” menu item.

For use with the import routine, the following need to be set:
- Name is compulsory
- Type must be set to “Import”
- Description is optional
- Table is optional
- Query is optional

You can then select the steps you wish to run, and decide in which order you wish to run them. If you select “Stop On Error”, then the error will be raised to the import routine, and not further processing will take place for this instance of the process. If you choose to ignore the errors, the following step will be run and the import routine will not be notified.
Sample process
The above steps will be used to first update the records, then allocate them to a new Infinity calls list.


In order to allocate a process to an import definition, the process must first have been created.

On the “Update” tab of the import definition, two drop-downs are available:
- The first one allows you to choose a process to run after each record is loaded into the database.
- The second one allows you to choose a process to run once all the data has been loaded.
In this example, I have set it to create automatically an Infinity calls list once all records have been imported.

Once associated with the import definition, the process will run automatically as selected, and no further action is required.
Import with Workflow review
In this procedure you learned how to:
- Create a Workflow Step
- Create a Workflow Process
- Select and run the Workflow Process