# Create Import and Index Tasks

Import tasks are configured in the `[ImportTasks]` section of the CFS configuration file. Import tasks run when files are imported, for example when a new item is retrieved from a repository or when the content of a file in a repository is updated. Use the `Pre` parameter to specify a list of tasks to run before KeyView filtering, and the `Post` parameter to specify a list of tasks to run after KeyView filtering.

Index tasks are configured in the `[IndexTasks]` section of the CFS configuration file. Use the `Update` parameter to specify a list of tasks to run when a connector instructs CFS to update the metadata of a document. Use the `Delete` parameter to specify a list of tasks to run when a connector instructs CFS to delete a document from indexes such as IDOL Server.

The tasks that you define run in sequence. In the following example, CFS creates an IDX file, then runs a Lua script, and then creates another IDX file:

    [ImportTasks]
    Post0=IdxWriter:C:\IDXArchive\before_script.idx
    Post1=Lua:C:\Scripts\my_script.lua
    Post2=IdxWriter:C:\IDXArchive\after_script.idx

To create an import task

1. Stop CFS.
2. Open the CFS configuration file.

3. Find the `[ImportTasks]` section of the configuration file, or create it if it does not exist.

4. Add the task by setting the `Pre` or `Post` parameter.

   The value of the `Pre` or `Post` parameter must be the name of the task that you want to run. Some tasks also require further information, such as the name of a file or the name of a section in the configuration file.

   For example, to run a Lua script before KeyView filtering:

       [ImportTasks]
       Pre0=Lua:myscript.lua

5. Some import tasks require you to identify the documents to process by adding a field to the documents. For example, the `IdolSpeech` task only runs on documents that have the `AUTN_NEEDS_TRANSCRIPTION` field. For more information about the document fields that are used with import tasks, see Document Fields for Import Tasks.

   To add a field to the documents that you want to process, use a Lua script. In the following example, a Lua script named `Filter.Lua` runs before an `IdolSpeech` import task, to identify suitable documents and add the field `AUTN_NEEDS_TRANSCRIPTION`.

       [ImportTasks]
       Pre0=Lua:Filter.lua
       Pre1=IdolSpeech:IdolSpeechSettings

6. Save the configuration file and restart CFS.

To create an index task

1. Stop CFS.
2. Open the CFS configuration file.

3. Find the `[IndexTasks]` section of the configuration file, or create it if it does not exist.

4. Add the task by setting the `Update` or `Delete` parameter.

   The value of the `Update` or `Delete` parameter must be the name of the task that you want to run. Some tasks also require further information, such as the name of a file or the name of a section in the configuration file.

   For example:

       [IndexTasks]
       Update0=Lua:myscript.lua

5. Save the configuration file and restart CFS.

© Copyright 2019 Micro Focus or one of its affiliates | Send documentation feedback Close Send documentation feedback To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a mail client, and then send this email to swpdl.idoldocsfeedback@microfocus.com. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_FT_HTML5_bannerTitle.htm