Using JSM Datacenter API, how to assign an organization to a Customer Request ?

Jean
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 16, 2024

Hello,

I'am trying to create a Customer Request linked to one of my organization. This creation is made through the API.

Here's what my request look like to create a basic Incident :

 

{
    "serviceDeskId": "1",
    "requestTypeId": "14",
    "requestFieldValues": {
        "summary": "Test issue org1",
        "description": "test"
    }
}
This request is by default not linked to an Organization, and it is a problem for me.
I  have orgs created with ID 1, 2 & 3, but can't find the field name that I could use to set that.
I listed the fields available using this request :

 

http://<myinstance>/rest/servicedeskapi/servicedesk/1/requesttype/14/field
and the response was :

 

{
    "requestTypeFields": [
        {
            "fieldId": "summary",
            "name": "Résumez le problème",
            "description": "",
            "required": true,
            "validValues": [],
            "jiraSchema": {
                "type": "string",
                "system": "summary"
            }
        },
        {
            "fieldId": "description",
            "name": "Description",
            "description": "",
            "required": false,
            "validValues": [],
            "jiraSchema": {
                "type": "string",
                "system": "description"
            }
        },
        {
            "fieldId": "attachment",
            "name": "Pièce jointe",
            "description": "",
            "required": false,
            "validValues": [],
            "jiraSchema": {
                "type": "array",
                "items": "attachment",
                "system": "attachment"
            }
        },
        {
            "fieldId": "components",
            "name": "Choisir un système",
            "description": "",
            "required": false,
            "validValues": [
                {
                    "value": "10012",
                    "label": "Imprimantes",
                    "children": []
                },
                {
                    "value": "10008",
                    "label": "Intranet",
                    "children": []
                },
                {
                    "value": "10009",
                    "label": "Jira",
                    "children": []
                },
                {
                    "value": "10000",
                    "label": "Répertoire actif",
                    "children": []
                },
                {
                    "value": "10010",
                    "label": "Réseau de bureau",
                    "children": []
                },
                {
                    "value": "10014",
                    "label": "Serveur VPN",
                    "children": []
                },
                {
                    "value": "10001",
                    "label": "Service analytique et de rapport",
                    "children": []
                },
                {
                    "value": "10015",
                    "label": "Services d'achat de la boutique en ligne",
                    "children": []
                },
                {
                    "value": "10005",
                    "label": "Services d'e-mail et de collaboration",
                    "children": []
                },
                {
                    "value": "10004",
                    "label": "Services de centre de données",
                    "children": []
                },
                {
                    "value": "10002",
                    "label": "Services de facturation",
                    "children": []
                },
                {
                    "value": "10011",
                    "label": "Services de paie",
                    "children": []
                },
                {
                    "value": "10003",
                    "label": "Services de stockage en ligne",
                    "children": []
                },
                {
                    "value": "10006",
                    "label": "Services financier",
                    "children": []
                },
                {
                    "value": "10007",
                    "label": "Services Ressources Humaines",
                    "children": []
                },
                {
                    "value": "10013",
                    "label": "Site internet public",
                    "children": []
                }
            ],
            "jiraSchema": {
                "type": "array",
                "items": "component",
                "system": "components"
            }
        },
        {
            "fieldId": "priority",
            "name": "Comment est-ce urgent?",
            "description": "",
            "required": false,
            "validValues": [
                {
                    "value": "10000",
                    "label": "Bloqueur",
                    "children": []
                },
                {
                    "value": "2",
                    "label": "High",
                    "children": []
                },
                {
                    "value": "3",
                    "label": "Medium",
                    "children": []
                },
                {
                    "value": "4",
                    "label": "Low",
                    "children": []
                },
                {
                    "value": "10001",
                    "label": "Mineure",
                    "children": []
                }
            ],
            "jiraSchema": {
                "type": "priority",
                "system": "priority"
            }
        },
        {
            "fieldId": "customfield_10103",
            "name": "Quel est l'impact ?",
            "description": "Par exemple si cela affecte x personnes, sélectionnez Important. Voir [nom du lien |http://exemple.com] pour l'explication.",
            "required": false,
            "validValues": [
                {
                    "value": "10000",
                    "label": "Extensif/Étendu",
                    "children": []
                },
                {
                    "value": "10001",
                    "label": "Important/La",
                    "children": []
                },
                {
                    "value": "10002",
                    "label": "Modéré/limité",
                    "children": []
                },
                {
                    "value": "10003",
                    "label": "Mineur/Localisé",
                    "children": []
                }
            ],
            "jiraSchema": {
                "type": "option",
                "custom": "com.atlassian.jira.plugin.system.customfieldtypes:select",
                "customId": 10103
            }
        }
    ],
    "canRaiseOnBehalfOf": true,
    "canAddRequestParticipants": true
}
And I don't see any field that look like the Organization field available on the Web Interface, any idea ?

1 answer

1 accepted

0 votes
Answer accepted
Jean
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 16, 2024

I've found the solution I was looking for,

 

First thing to do :

From the API :
Make a request to /rest/api/latest/field, and find the field Organizations, and save the "id" parameter.

From the Web Interface :
Go to Administration > Issues > Custom Fields, find the field "Organizations", click on the three dots on the right and View. Check the URL and the parameter customFieldId, in my case it was ?customFieldId=10002, so this is my organization field id.

 

Now if I want to specify my organization in my issue, my json would look like :

{
    "serviceDeskId": "1",
    "requestTypeId": "14",
    "requestFieldValues": {
        "summary": "Test issue org1",
        "description": "test",
        "customfield_10002": [1]
    }
}
And you have to replace 10002 by the ID of the field you found, and 1 by the ID of the organization.

 

Hope it helps someone !

 

Best regards

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events