Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,368,999
Community Members
 
Community Events
168
Community Groups

Create / clone issue when project name is smart value / dynamic

Hello, community.
Is there a way to create a new issue (or clone) without providing a specific project name?

In other words, i need a rule that can create an issue, while target project is based on a trigger' field value (assume that there is a field with the project key or name (tried both) provided by a user and can vary.

tried using smart values for both project and issue type and it fails on 'project name is required'. 

 

i have a workaround in mind but i don't like very much.. (it requires a rule for each possible project, bunch of flags and complex maintenance )

 

thank you in advance!

1 answer

0 votes
Simmo Atlassian Team Sep 29, 2020

Hi @Alex Rouk ,

Not sure which Automation you're referring to. But if you're referring to Jira Automation (formally Automation for Jira) then there is an option in the UI that will do what you want to acheive:

createissue.pngCheers,

Simeon

Thanks, @Simmo  Yeah, that Automation :) 

My issue is that I don't want (can't) to put a specific Project name because it is uncertain when i'm creating the rule. So i wanted either to use field's value there or a variable.

Is it possible?

Thank you!

Simmo Atlassian Team Sep 30, 2020

Hi @Alex Rouk ,

Does the "same project" option not work for you? It will try to determine it based on the trigger context. So you shouldn't have to specify a project.

Thank you again, @Simmo .

it is not that simple..

Imagine i have a rule triggered from project A. The rule is supposed to create a new issue in another project (B, C, D..), based on a value of projectA_field. The value of projectA_field is entered by user.

For example, if projectA_field = "B", the issue will be created in B, if projectA_field="C", then in project C. 
Project A is kind of a hub, creating tickets dynamically in other projects

Hope this clarifies.

thanks! 

Simmo Atlassian Team Oct 01, 2020


Hi @Alex Rouk , yeah I'm starting to get the picture now. Is it possible for you to share a few screenshots of how you have configured your rule so we can figure this out?

@Simmo , i can definitely share anything :) but I am not sure what can i share..

attached a dummy rule that covers my need.. hope it helps..

thank you again for the time and willingness to help. much appreciated!

 example.png

Ste Community Leader Sep 29, 2021

Hi @Alex Rouk 

Did you ever work this out? I'm also trying to get this to work!

Ste

I've been working on a similar feature. I have a select field to select the project (eg customField_1). I matched the project name with the selections in that field. In Create issue action I put in {{customField_1}}. I get an error that meta data could not be created for project/issuetype.  I've tried similar with Issue Type using a field {{customField_2}} with the value of "Story" and got the same error. It is as though these fields support smart value entries, but it doesn't seem to accept the values unless I'm doing something wrong. I've also tried values for key and the format ProjectName (key) that the selections show. 

The workaround I am thinking of testing is using the send web request action to create issues based on smart values. Setting the payload would be the only hard part. 

@Alex Rouk @Matthew Patton @Simmo Did anyone ever figure this out? I am trying to accomplish something similar. The audit log shows the smart value I have in the Project field of the Create Issue action does match an existing project key, but the automation fails saying no key was provided.

I was able to get my use case to work by using the PID instead of the key or name. I found the PID by navigating to the project's edit page, and it was in the URL. Somewhat cumbersome, but it worked.

Like Thierry BLOCH likes this

Interesting, so you used the ID for both the Project and IssueKey Type(i assume no id here would go to the default issue type)?  I haven't tried it.  I ended up not having to pursue this further due to some changes in plan.

I have written scripts to create tickets, and seeing that the payload uses IDs, it makes sense for what Blake mentioned. Here is an example for POST.

 {
        "fields": {
        "project":
        {
            "id": "<PID>"
        },
      "issuetype": {
            "id": "<typeID>"
        },
       "customfield_1234": "value"
}
To make it more flexible you would probably send a Get request in Jira automation to get the id's using /rest/api/2/project/<projectKey>. The response to get the PID can be written something like {{webhookResponse.body.results.id}}
If you only have a few projects it would be easier to have a select field with project names. The automation would trigger based on that field change>IF/Else Block for each field value, then add the action to create issue for each field condition. The example below would create a Task in (CMOT) if Project Name = Project1, or Task in (DEM) if Project Name = Project2.
Capture.PNG
Like Thierry BLOCH likes this

Yes, that would make sense to add flexibility, but in this case, it's a hard configuration for me depending on an Insight object selected in a different field, so that object just has the project's PID as an attribute.

Hello,

This is exactly what i need to implement. If someone can show a step by step process, it will be very awesome.

I was able to achieve this by using the additional fields to overwrite the Project that I need to create the issue.

Untitled.png

 

In my case I have a custom field named "Activity" and the options are

  • Task A - ASP
  • Task B - DSP
  • ...

 

The bold section is the project that the task should be created into, so I was able to do extract the project key using substringAfter and then use to as the project key.

 

{
"fields": {
"project":{
"key": "{{issue.Activity.value.substringAfter("-").trim()}}"
},
"Parent link": "{{triggerissue.key}}"
}
}

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events