Unable to import Customer Request Type with CSV/JSON in JSM DC

XMLWordPrintable

    • 2
    • Severity 3 - Minor
    • 8

      Issue Summary

      When importing issues via CSV or JSON using the integrated Jira Importers Plugin (JIM), the "Customer Request Type" (com.atlassian.servicedesk:vp-origin) field fails to accept request types using their display name.

      This is a regression of JSDSERVER-1335, which was initially fixed in JSM 5.15.2 (Jira 9.15.2).

      Steps to Reproduce

      1. Install Jira Service Management Data Center.
      2. Create at least one service project.
      3. Prepare a CSV import file (Importing data from CSV), targeting that project with a populated "Customer Request Type" column.
      4. From ⚙️ (gear icon) > System > External system import > CSV, import the test CSV file.

      Expected Results

      The "Customer Request Type" custom field is correctly mapped, and the request type is set on the imported issue.

      Actual Results

      The import finished page reports:

      1 projects and 1 issues imported successfully!

      Cannot add value [ [IT help] ] to CustomField Customer Request Type in Issue with summary 'My laptop is consistently above 90% CPU'. Probably value was in incorrect format

      In the imported issue's service project request panel, the "request type" is "no request type".

      Workaround

      Database approach

      Replace the display name with the internal portal/request type storage format. You can obtain these values for a particular project with this database query:

      SELECT p.pname                        AS project_name,
             p.pkey                         AS project_key,
             vpf."NAME"                     AS request_type_name,
             (vp."KEY" || '/' || vpf."KEY") AS request_type_key
      FROM "AO_54307E_VIEWPORTFORM" vpf
               JOIN "AO_54307E_VIEWPORT" vp ON vpf."VIEWPORT_ID" = vp."ID"
               JOIN project p ON vp."PROJECT_ID" = p.id
      WHERE p.pkey = 'ITHD'
      ORDER BY project_name, request_type_key;
      

      Replace "ITHD" with the project key. For the example above, the replacement value is: ithd/getithelp

      REST API approach

      First, find the project's portal ID via: GET /servicedeskapi/portals/project/{projectKey}.

      Once you've obtained that, you can use an (internal) REST endpoint (POST /rest/servicedesk/1/customer/models) to obtain both parts of the request type key:

      curl --request POST \
        --url https://<jira-base-url>/rest/servicedesk/1/customer/models \
        --header 'Accept: application/json' \
        --header 'Content-Type: application/json' \
        --header 'Authorization: Bearer <pat>' \
        --data '{"models":["portal"],"options":{"portalId":25,"portal":{"expand":["reqTypes"]}}}'
      

      Populate the Jira base URL and personal access token (PAT), then replace “25" in the body with the portal ID you just found.

      The results will contain:

      {
        ...
        "portal": {
          "id": "25",
          "key": "ithd",
          "projectId": 10000,
          "serviceDeskId": 25,
          "name": "IT Help Desk",
          ...
          "reqTypes": [
            {
              "id": "1",
              "key": "getithelp",
              "name": "IT help",
              ...
            }
          ],
          ...
        }
      }
      

      From portal->key and portal->reqTypes[]->key, you can construct the full request type key with a forward slash ("/"). In this instance: ithd/getithelp.

      Always use the key from the portal object rather than just lowercasing the project key, since the portal key will not adjust with project key changes.

              Assignee:
              Unassigned
              Reporter:
              Benjamin S
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: