Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

JMWE Create Issue Post Function Iterate through Multi select custom field Count

Prathap DL
Contributor
July 17, 2024

Hi Team,

 I'm using JMWE Create issue(s) Post-function to create Ticket. Its working for single ticket creation. But i need to create multiple ticket based on multi select Custom field Value count.

If Multi select custom field has 2 values then i need to create 2 tickets automatically. If we selected 5 values from Multi select custom field then 5 tickets should get auto create.

It will be helpful if i get Code which works for above requirement.

 

Cheers.

2 answers

1 accepted

1 vote
Answer accepted
Ralf Fehling
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 17, 2024

Hey 👋

Multiple issue creation: Use this section to create multiple issues based on the settings you provide.

Iterator (displayed only when the previous option is selected): Enter a Nunjucks template that must return a comma-separated list of values to iterate on. This can be either a comma-separated list of Strings, or a JSON array only if you check the "Iterator returns JSON" option. The post-function iterates over the list and creates one new issue per value

{{issue.fields["Multi-select field"]  | dump }} with "Iterator returns JSON" option selected will create one issue per selected option in the Multi-select field

https://innovalog.atlassian.net/wiki/spaces/JMWEC/pages/120815650/Create+issue+s

Best Regards

Ralf 

Prathap DL
Contributor
July 18, 2024

Hi @Ralf Fehling 

It worked. I really appreciate your assistance, it made all the difference in solving my problem! 

 

Thanks.

Prathap DL

0 votes
Graham Twine
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 17, 2024

Hello @Prathap DL and welcome to the community :)

 

You can take the code you have that creates the issue and look at the number of items in the multi select list as a count.

 

issue.getCustomFieldValue('Multi Select List')?.each{ currentValue ->

//paste your existing code here
// You also have the current value
// if you need to populate the issue with it
Issues.create('ABC', 'Task') {
setSummary('my first HAPI 😍')
}

}

Have a look at the following from Adaptavast's documentation

Prathap DL
Contributor
July 18, 2024

@Graham Twine  Thanks for the support. But I got exact answer from @Ralf Fehling 

 

Regards,

Prathap DL

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events