Forums

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

JMWE On post function create issue, assign to Project based on custom field input

Zac Boyd
Contributor
January 22, 2023

Using Groovy for the first time through JMWE

Setting up a post function that will create a new issue and assign it to a Project using a custom field (Single Select List) value. 

Tried: 

x = issue.get("customfield_1000")

issue.setProjectObject(x)

 

Also tried:
def customFieldManager = ComponentAccessor.getCustomFieldManager()

def customField = customFieldManager.getCustomFieldObjectByName("Project")

def newValue = issue.getCustomFieldValue(customfield)

 

issue.setProject(newValue)

 

All with no luck. Thanks for the help in advance !

2 answers

1 accepted

1 vote
Answer accepted
Zac Boyd
Contributor
January 31, 2023

Logged a ticket with the @Appfire Support team who answered the question. Thought i'd repost the answer to let others know !

In JMWE you could use the “Calculated” project option on the Create/Clone Issue(s) post-function. Please refer to the example below:image-20230127-145733.png

 

In the example above, the custom field type is a project picker. Then you can decide what will trigger the post-function hence the issue copy/clone.

For example, you could use Event Based Actions to execute the post-function once a specific issue field value is changed or when the issue itself is transitioned.

0 votes
Vamsi Kandala
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.
January 23, 2023

Hi @Zac Boyd

Welcome to the community!

If I understand you correctly, you want to create the issue dynamically in another project say ABC based on the selection of custom field value in project XYZ.  

Did you try considering doing this using automation rules?

Thanks,
Vamsi

Zac Boyd
Contributor
January 23, 2023

Yes i have, 

As a work around we have a manual trigger set up to link to one Project, but we have over 15 projects currently and trying to create a way to set it based off the field doesn't work in Automations. 

Tried: 

Trigger= When Value changes for Field X

Action= Then Create a New issue,

Project = "Same project as trigger" ( This is then run as the project the automation runs from)
I have found no better options to select a custom field dynamically in automation

Vamsi Kandala
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.
January 23, 2023

Hi @Zac Boyd

Automation rules are generally specific to the related projects only.  

If you want to create an issue in Project XYZ after an issue is created in Project ABC, you are accessing multiple projects.  So, you will have to create the automation rule in the global level.  That way, you will have option to select the specific project that you want.

Note that, the owner of the automation rule should have related permissions in all the affected projects.

Hope this helps.

Thanks,
Vamsi

Zac Boyd
Contributor
January 23, 2023

Sorry, i should've been a bit more clear, the above is at the Global level. 

I cannot set the Action to choose a dynamic field. You can only either state a specific project or "current project" or "trigger project"

The reason i want to set it as dynamic is that we are expecting a large influx of Projects to be created so i want to avoid creating a Multiple automations each time a Project is created.

Vamsi Kandala
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.
January 24, 2023

Hi @Zac Boyd

Understood.

I have checked different things and did not work for me either.  I am not completely sure whether it is possible using post functions.

Please check with Atlassian support if you have not already contacted them.  And please update here if you are able to find the solution.

Thanks,
Vamsi

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events