1
0
-1

Sync between JSM and JSW - change the project in which the issue is synced, based on the properties of the request. 

  1. Javier Pozuelo

    Hello George,


    I'm a little bit confused, could you elaborate a bit more on what you are trying to do?


    Thanks

  2. Vojtěch Veselý

    My usecase is to access certain properties that the available classes which wrap the fields doesn't have. For example field "Request Type" when returned from issue."Request Type" has only a few properties when compared to the equivalent returned from Jira REST API. 

    issue."Request Type"

    [
    	serviceDeskProjectKey:RQST, 
    	class:class com.exalate.basic.domain.hubobject.v1.BasicHubVpOrigin,
    	requestTypeKey:null, 
    	serviceDeskProjectName:Standard Requests, 
    	serviceDeskId:1, 
    	representationValue:null, 
    	requestTypeName:Other, 
    	requestTypeId:166, 
    	portalKey:null
    ]

    Jira REST API when returned as a field /rest/api/3/issue/:issueKeyOrId using postman (I subtracted some texts)

    {
          "_links": {
            "jiraRest": "{subtracted}",
            "web": "{subtracted}",
            "self": "{subtracted}",
            "agent": "{subtracted}"
          },
          "requestType": {
            "_expands": [
              "field"
            ],
            "id": "166",
            "_links": {
              "self": "{subtracted}"
            },
            "name": "Other",
            "description": "{subtracted}",
            "helpText": "",
            "issueTypeId": "10003",
            "serviceDeskId": "1",
            "portalId": "1",
            "groupIds": [
              "30"
            ],
            "icon": {
              "id": "10593",
              "_links": {
                "iconUrls": {
                  "48x48": "{subtracted}",
                  "24x24": "{subtracted}",
                  "16x16": "{subtracted}",
                  "32x32": "{subtracted}"
                }
              }
            }
          },
          "currentStatus": {
            "status": "Waiting for support",
            "statusCategory": "INDETERMINATE",
            "statusDate": {
              "iso8601": "2023-10-09T13:24:33+0200",
              "jira": "2023-10-09T11:24:33.295+0000",
              "friendly": "Monday 1:24 PM",
              "epochMillis": 1696850673295
            }
          }
        }

    You can also retrieve the data about request type from servicedesk API.


    The main issue is that the httpClient doesn't return the same values. The same field returned using httpClient looks like this:

    [
        _links: [
            jiraRest:{subtracted}, 
            web:{subtracted}, 
            self:{subtracted}, 
            agent:{subtracted}
        ], 
        requestType:[
            name:Other, 
            groupIds:[], 
            description:{subtracted}, 
            icon:[
                id:10593, 
                _links:[
                    iconUrls: {
                        "48x48":"{subtracted}",
                        "24x24":"{subtracted}",
                        "16x16":"{subtracted}",
                        "32x32":"{subtracted}" }
                    ]
            ], 
            portalId:1, 
            issueTypeId:10003, 
            helpText:, 
            id:166, 
            serviceDeskId:1, 
            _expands:[], 
            _links: [self: {subtracted}]
        ], 
        currentStatus: [
            status:Waiting for support, 
            statusCategory:INDETERMINATE, 
            statusDate: [ 
                iso8601:2023-10-09T11:24:33+0000, 
                jira:2023-10-09T11:24:33.295+0000, 
                friendly:Monday 11:24 AM, 
                epochMillis:1696850673295
            ]
        ]
    ]

    For my usecase the required property is "groupdIds" in requestType.groupIds. As you can see the returned value from httpClient is empty but from the REST API it has a value. I don't know why but the URL request is the same. Also the requestType._expands property is empty.


    The servicedesk api
    /rest/servicedeskapi/servicedesk/:serviceDeskId/requesttype/:requestTypeId

    has the same issue, groupIds are empty.

CommentAdd your comment...

1 answer

  1.  
    1
    0
    -1

    Hello,


    Unfortunately, due to Jira Cloud limitations, automatically moving issues is not applicable. 


    You can still synchronize in different project with a single connection, but this can be done only when an issue is created on the destination side for the first time using the "Exalate" option. 


    For example: If the issue sent is of type Bug from the project SD, create an issue with the type Test in the project Testers. In other cases create an issue with the type of Task in the project Developers.


    Incoming Sync destination side 

    if(firstSync){
    if(replica.project.key == "SD" && replica.type.name == "Bug") {
    2   issue.projectKey   = "TESTERS"
    3   issue.typeName     = "Test" 
    4 }
    5 else{
    6   issue.projectKey   = "DEVELOPERS"
    7   issue.typeName     = "Task"
    8 }
    }

    If you have several project and type names, you could do a project and type mapping.


    Regards,

    Javier

      CommentAdd your comment...