Hi all,I am going mental with this integration. I hope you guys can give me a hand or at least ...

  • 5 August 2020
  • 3 replies
  • 14 views

Badge

Hi all,

I am going mental with this integration. I hope you guys can give me a hand or at least point into the right direction. I feel like I am already there just need a little push.

I get a response from an action. The response looks like this:

{
    "expand": "names,schema",
    "startAt": 0,
    "maxResults": 1,
    "total": 1,
    "issues": [
        {
            "expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields",
            "id": "31804",
            "self": "https://xperigo.atlassian.net/rest/api/3/issue/31804",
           * *"key": *"SD-2661"*
        }
    ]
}

I tried to get the key's content under issues (bold); the response panel only give the issues to pass down as another action but seems to be that it is passing to much

[
        {
            "expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields",
            "id": "31804",
            "self": "",
            "key": "SD-2661"
        }
    ]



🗨 Link to Slack thread

3 replies

Userlevel 2
Badge +2

@dalfonzo The issue is the array. Since the object you’re looking to use in dynamic fields is an array, we’re unable to pick that up.

Badge

Hey JB,

I tried the data transformation as we did before but does not seems to work.

here is the data transformation script:
module.exports = function(input, callback, error) {
const text = input.request.body.fields.parent.key;

delete input.request.body.fields.parent;
input.request.body.fields.parent= {"key":text[0].key};

console.log(JSON.stringify(text[0].key));
callback(input.request)

}

Anything there you can call out quickly, if it way different then we can go over a session.

Userlevel 2
Badge +2

We don’t have ‘post-request scripts’, unfortunately. Meaning we cant manipulate the data that comes back from the webhook execution.

However, there are probably one or two ways to get around this. IIRC, you have two actions. One that looks up the ticket, and another that does something with it. You could combine those two actions. You could put your first action in a pre-request script and feed that ticket ID into the webhook.

Reply