Use this task to import all rows from a CSV file as core objects.
The following must apply:
- The file must exist in the data map as byte array.
- To achieve this, upload a CSV file in a prior user task.
- As form field, use either a data pool field with data type "Binary Data" or a "Variable Binary Field". The "Binary Data Definition" should be "CSV" in both cases.
Whenever there is a problem with the import, no objects will be imported at all. An exception will be thrown with a message identifying the row or even the cell that caused the problem. This message will be logged, too.
To use this task, configure the following delegate expression in your service task:
The following parameters can be configured in Identity Manager Admin:
|csvField||The field which contains the CSV file as byte array. You can use a Binary Field or a Variable Binary Field.|
The core template name which should be used for the new core objects. This should be based on a DAO based Datapool.
|commaSeparatedListOfUniqueIdentifiers||Comma separated list of the fields which identify one unique core object.|
This can be used to limit the number of core objects. If it's set and there are more entries in the CSV, an Exception will be thrown.
|createdCoreObjectDescriptorListVarName||When used, the variable with the configured name will contain a list of CoreObjectDescriptors after the execution. The list describes the core objects that had been newly created by the action. Thus it's possible to perform subsequent operations on those core objects later in the process.|
Same as for createdCoreObjectDescriptorListVarName except that the list will contain the modified core objects.
When you configure the same name as for createdCoreObjectDescriptorListVarName the resulting list will contain descriptors for both types of core objects: newly created as well as modified.
Specifying a mapping provides manifold possibilities to configure the content of the CSV file. Without a mapping the following restrictions apply:
Also consider this:
- When providing a mapping, its source data pool describes the CSV file while it's target data pool must be the datapool of the target core template.
- The source data pool must have a data source of type "CSV File".
- At the data source of the source data pool you can configure, whether the CSV file contains a header row or not.
- At the data source of the source data pool you can configure the delimiter character used in the CSV file.
- You may leave the data source's file name empty.
- The data pool fields of the source data pool must match the columns of the CSV file in the correct order. All fields must be of type "Text". The field names can be chosen arbitrary.
- The field mappings of the mapping define which columns of the CSV file are imported. You may omit fields of the source data pool. All fields of the target data pool that are contained in the commaSeparatedListOfUniqueIdentifiers must be mapped.
- If the CSV file contains columns that are mapped to data fields of the target data pool of type date, time or datetime, you must configure the format with the field mapping.
- See here for information about creating a new or editing an existing data pool.
- See here for information about creating a new or editing an existing mapping.
|errorMessageField||ErrorMessage||If this field is provided and an error occurs, a message containing the cause is not only logged but additionally put into the variable with the specified name.|