Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

JMWE + JSM Assets = <3

Aaron Jurrens October 24, 2024

JSM Assets is a good tool. JMWE is a great tool. Together, they are greater than the sum of their parts.

Note: for the remainder, "automation" or "rule" or variants thereof all refer to JMWE.

The problem to be solved is this:

Build an automated issue creation engine such that:

  • when a request type comes in, it should spawn either:
    • a sequence of story and / or task tickets
    • a batch of story and / or task tickets
  • each spawned story and / or task ticket should then be able to spawn either:
    • a sequence of story and / or task tickets
    • a batch of story and / or task tickets
  • and so forth.

We know what the ticket structure should be ahead of time based on various requests made by the business. It's a complex stack of process accumulated over decades; a pre-defined (and sometimes chaotic) branching structure of tickets.

Loki TV Source — sersi: References to and Explanations of Branch...

Cue JMWE. 

Movies and Chill — WandaVision (2021 - )

Initially, and separately, submitted request types are triaged and curated automatically by another rule. After that rule runs, the story and task creation engine fires up -- that is, *if* the request type has associated stories and / or tasks. All of that is stored in JSM Assets.

In this scenario, Request Types, Stories, and Tasks all have corresponding records (and approval structures!) in Assets.

The easy part of this was building the sequencer:

  • when request type is submitted, attach the first sequenced issue
  • watch for sequenced issues (based on issue type) to close
  • check their asset records for a defined next issue in the sequence
    • if found, create the next issue (and rinse, repeat)
    • if not found, exit the sequence

The more interesting part was building the batch issue handler. Now, one could build for loops with API calls, and that's it's own brand of fun, orrrr.... one could use JMWE's iterator.

Basically, the cool part of the batch handler lives inside a create issue post-function's iterator and that looks like this:

< call include for API creds >
< call include for Assets workspace ID >
< check asset field value on request type for batch child asset objects >
< build empty child object array >
< for loop to add each child object to the array >
< build empty iterator values array >
< for loop to process each child object >
< build API URL using workspace ID and the asset ID of the child object >
< use callRest to get the asset object via the URL above >
< parse that record to set a few variables: >
< summaryVar >
< descriptionVar >
< issueTypeVar >
< whatever else you want to set on the created issues >
< use those variables to set JSON values to pass to the iterator >
< arrayName.push({summary:summaryVar,description:descriptionVar,issuetype:issueTypeVar,whatever:whateverVar}) >
< exit the for loop >
< dump the array >

You'll end up with some number of array values (let's say you have three):

[
  {
    "summary": "Summary Attribute Text Value from Object 1",
    "description": "Description Attribute Text Value from Object 1",
    "issueType": "Story"
"whatever" : "a1b2c3d4-e5f6-7890-abcd-ef1234567890:19" }, { "summary": "Summary Attribute Text Value from Object 2", "description": "Description Attribute Text Value from Object 2", "issueType": "Task" "whatever" : "a1b2c3d4-e5f6-7890-abcd-ef1234567890:14" }, { "summary": "Summary Attribute Text Value from Object 3", "description": "Description Attribute Text Value from Object 3", "issueType": "Story" "whatever" : "a1b2c3d4-e5f6-7890-abcd-ef1234567890:13"
} ]

Then, in the respective fields above the iterator, earlier in the create task(s) post-function, you do like this:

Summary:

{{it.summary}}

Description:

{{it.description}}

Issue Type:

{{it.issueType}}

Whatever:

{{it.whatever}}

...and click all the update and save buttons. Once this runs from whatever transition or event-based action, you'll have three issues from those three array values.

For those of you still reading along at home, I'll point out the value from the array above:

"whatever" : "a1b2c3d4-e5f6-7890-abcd-ef1234567890:13"

You can retrieve asset object globalId's and use them to set other asset fields on the issues.

Thanks for reading!

cheers | GIF | PrimoGIF

0 comments

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events