How to count issue types and add it to a custom field


The first is to fetch all issue types, which we do by creating an Action.

Let's call the action "Count issue types" this action will fetch the issue types and pass the result to a child action.

Let's create the child under the "Count issue types"  and call it "Put count into field".


The result should look like the above.


Configure the Count issue types" as on the picture, but with your own authentication.

Next go to the child action.

Configure the child action to use a variable called length with the value $.length()    

Note that the count needs to have parentheses to act as a function.

Use a body to set the custom field. In this example the field is a number field, then do not quote for the {{length}} 


{
    "fields":{"customfield_10801":{{length}}}
}


This will count the parent response of the issue types as the image below shows.