Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This article explains how to make use of the import.properties file to be used along with runFromCsv action in order to eliminate manual corrections to the column names in the CSV file

Instructions

  1. The propertyFile parameter is used with runFromCsv action to
    1. allow field (column) name mapping 
    2. allow field specific data mapping values
  2. The example below shows a use case of removing organization users in a Jira Service Desk project which is retrieved from getOrganizationUserList action
  3. The action below creates a CSV file that has the list of users in an organization.

    Code Block
    themeMidnight
    --action getOrganizationUserList --organization "testorg" --file test.csv


  4. The generated CSV file looks as shown below
  5. The action removeOrganizationUsers accepts organization and participants as parameters. As the column User in the CSV file is same as participants, this change can be mentioned in the import.properties file without manually making the change
  6. The import.properties file here maps the field headings (i.e User) to parameters (i.e. participants) that can be understood by the Command Line Interface (CLI).

  7. The left side values are the header names of the CSV file and the right side values are the CLI parameters that are to be mapped.

  8. The respective column name should be preceded by "field.col_name" (i.e. "field.User" in this case)
  9. Refer to the screenshot of the import.properties file below
    Image Modified

  10. Run the below action to delete the list of users which are listed in the CSV file

    Code Block
    themeMidnight
     --action runFromCsv --file "test.csv" --common "-a removeOrganizationUsers"  --propertyFile "./src/itest/jira/resources/import.properties"

    If the property file is saved in the ACLI client directory, then the name of the file can be directly mentioned. However, if the file is placed somewhere else, then provide the complete path of the file location

  11. The use of properties file helps automate the processes eliminating manual interruptions of modifying the CSV input file header names to parameter names that are accepted by the CLI.


Info
It is recommended to test this scenario in a non-production environment or run the action with the --simulate parameter, to verify the behavior before deploying on a production environment.