trying to add component using smart value user input

Sean Hagans April 12, 2024

I've got 2 projects (we'll say ABC and XYZ for ease) and am creating a rule to clone an issue from one to the other. 

They have different components. 

I have a rule in ABC that is triggered manually and prompts for user input. The desire is for a user input dropdown selection of XYZ project components. 

I have already looked for ways to populate that dynamically with XYZ components and gave up on that. Instead I have an option in that dropdown for each component in XYZ that I explicitly created on the rule. 

So in this case, my XYZ project has the following components (comp1,comp2,comp3). my rule in ABC has user input prompt "add component" that has the options comp1,comp2,comp3 and the name is RemoteComponent

My rule in ABC does a clone issue into XYZ and I have setting for Component field with a value of {{userInputs.RemoteComponent}}. 

After that my rule makes a comment on the ABC issue. 

 

When I run this action, I get an error on clone while parsing additional fields for invalid JSON. 

Is it possible to set a component with a smart value? 

1 answer

1 accepted

2 votes
Answer accepted
Kalyan Sattaluri
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.
April 12, 2024

Hello @Sean Hagans 

Welcome and Please share screenshot of your clone issue, especially this component field and how are your formatting your JSON. It has to be in certain format as listed here.  Thanks!

Sean Hagans April 12, 2024

I'm not editing JSON directly. I'm just using the UI option to set a field in the clone issue action. 

What I have at this point is super basic and literally just trying to add a user input smartvalue into the components field. 

 

JiraComponent1.jpgJiraComponent2.jpg

Bill Sheboy
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.
April 12, 2024

Hi @Sean Hagans -- Welcome to the Atlassian Community!

Would you please post an image of the audit log details from the rule execution, showing the error?  Thanks!

Kind regards,
Bill

Kalyan Sattaluri
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.
April 12, 2024

Hello, So user can choose 1 value from the dropdown when triggering this rule? And these values "Comp1", "Comp2"etc..are components names?

Sean Hagans April 12, 2024

the error is silly simple

JiraAutoError.jpg

______

Yes the Comp1 and Comp2 are component names in the target remote project.

Sean Hagans April 12, 2024

I have not edited the JSON, but here are the contents of the additional fields on the Clone Issue action.

 

{
    "update": {
      "labels": [
        {
           "add": "cloned"
        }
      ],
     "components": [
       {
          "add": {
            {
              {{userInputs.RemoteComponent}}
            }
        }
     }]
  }
}

Bill Sheboy
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.
April 12, 2024

I was hoping to see the entire log entry, not just the error, for some context.  Regardless...

I wonder if the rule got "glitched", with something stored in the advanced edit section which is not displaying.  Two ways to check that are:

  1. Disable the rule, wait a few seconds, re-enable it, and re-test.  If that does not help...
  2. Disable the rule, and re-create it from scratch.  Then re-test.

Rules can get "glitched" from too many edit / publish cycles, and so those actions can help to detect that problem.

 

Update, based on your last post: the problem is there is JSON trying to edit the field and it is selected from the dropdown list.  Only one of those techniques may be used for a field in a single issue edit action.

Sean Hagans April 12, 2024

For anyone replying, have you tried what I'm doing? Has anyone successfully used a userInput or general smart value as a value on components field? 

 

I'm assuming by the way people are asking that this is something that you've seen work and know it should work, and thus the only way it wouldn't be working is if I'm doing something wrong, is that correct?

Sean Hagans April 12, 2024

well I'm not doing any of that, I just added the components edit to the clone. Jira did the rest. Do I need to remove the JSON or something? I didn't write it or make it, I just looked at it by expanding that UI item at the bottom of the panel.

Also this is the 4th time I've made this same rule from scratch. It's literally as simple as I've put it here. 

1. Select new rule

2. Set as Manual trigger - check box to ask for input field - set field name, add values, set smartvalue name

3. Add Clone issue - set target project - add the set component - add smartvalue of input field as value for set component

 

Done. That's it. No other actions on this, no editing of defaults, literally just those 3 things. Repeated 4 times with the same failures.

Kalyan Sattaluri
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.
April 12, 2024

Hello @Sean Hagans 

Please dont get mad on Friday. We are just trying to help. LOL.

Remove the components selection from drop down.

In the JSON section, replace existing contents with below and retrigger the rule.

 

{
"update": {
"labels": [
{
"add": "cloned"
}
],
"components": [
{
"add": {
"name": "{{userInputs.RemoteComponent}}"
}
}
]
}
}

Sean Hagans April 12, 2024

I'm not angry, I just want to make sure I don't confuse people into thinking that I'm doing something other than selecting the UI options. I am also legitimately asking if anyone replying has done this or is doing this with success. No one has said "it works for me, here's what I have that is working". So I want to make sure that answers are related to finding out what is non-standard about mine rather than asking me to try things without knowing if it should work out of the box.

Removing the component edit from the clone and replacing the auto-generated "additional fields" JSON with yours results in a 400. 

Not sure if that's progress or not.

Kalyan Sattaluri
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.
April 12, 2024

Hello @Sean Hagans 

I have sucessfully tested your rule.

As you can see from my screenshot, my advanced JSON did not auto-populate with "components" object by itself.

One final try, delete everything in Advanced Section, redo the components drop down with your initial smart value, BUT, specifically choose the Issue Type..

image.png

image.png

Sean Hagans April 12, 2024

hey that worked! Thanks! 

I'm not sure why it's auto-populating on my side, but when I remove that manually and hit update, I get what you have there. I just recreated a new rule and it did the same thing. 

Looks like the problem is that for whatever reason, my rule is auto-generating a JSON in additional fields when I add a component field edit and that is messing it up. Removing that makes it work.

 

Thanks for the help.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events