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

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

Alex Rouk September 29, 2020

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!

2 answers

3 votes
Tony Villa-Cruz October 17, 2022

I think people are not seeing that this question has been answered, so I am re-posting @Italo _Modus Create_ 's answer as an answer outside of the the other answers thread, because I found that this answer does in fact work!

@Italo _Modus Create_ said:

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}}"
}
}

 Hope this helps people find the answer! This was a big unlock for me!

Andrej Goleniewski April 16, 2023

Thanks a lot!

0 votes
Simmo
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 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

Alex Rouk September 30, 2020

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
Atlassian Team members are employees working across the company in a wide variety of roles.
September 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.

Alex Rouk October 1, 2020

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
Atlassian Team members are employees working across the company in a wide variety of roles.
October 1, 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?

Alex Rouk October 1, 2020

@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
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 29, 2021

Hi @Alex Rouk 

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

Ste

Matthew Patton October 29, 2021

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. 

Blake Waud November 22, 2021

@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.

Blake Waud November 22, 2021

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
Matthew Patton November 23, 2021

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
Blake Waud November 24, 2021

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.

Thierry BLOCH July 12, 2022

Hello,

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

Italo _Modus Create_ September 27, 2022

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}}"
}
}
Tony Villa-Cruz October 17, 2022

See answer outside of thread!

Like Gleiciany Alves Cardoso likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events