Issue copying fields using the create issue post function with a seed

Pierre Ibrahim
Contributor
May 17, 2022

Hello,

I'm trying to add a post function that creates multiple issues using a seed JQL, and from that seed JQL I'm copying some fields to the resulting issues.

 

I'm facing two errors at this point:

1) Updating a field of type User Picker (single user), I'm not able to use a parser expression to get the first user from a list, but it works if I just copy a field from the current issue, like reporter. My parser expression is: 

first([%{Parent's multi-user-picker-field (Seed)}, %{Parent's different-multi-user-picker-field (Seed)}])

The parser expression validates and returns a result correctly if I'm testing within the post function itself, but on ticket creation I get the following error:

We can't create this issue for you right now, it could be due to unsupported content you've entered into one or more of the issue fields. If this situation persists, contact your administrator as they'll be able to access more specific information in the log file.


2) Updating a field of type Single Issue Picker, I can copy the same field from the current issue to the same field in the created issue, however, I'm trying to copy the issuekey of the seed issue. I should note that the single issue picker field uses a JQL for a valid list, and the seed is part of that JQL and I can select it manually.

 

For the second issue, the initial ticket gets created, but not the ticket from the post function.

JIRA.png

 

Any guidance on what I may be doing incorrectly here would be greatly appreciated!

1 answer

1 accepted

2 votes
Answer accepted
Sergio del Pino _Decadis AG_ May 18, 2022

Hi @Pierre Ibrahim

Your configuration is correct, however you have encountered two different problems which I will proceed to explain one by one:

  • Regarding the User picker error, it is caused by a bug within our seed field codes. As a workaround you can use our old seed field codes instead, so your field codes should look as it follows:
^%{parent.aaaaa}

Where aaaaa would be your User picker (multi) field code.

Besides, I would recommend you using the following expression instead, which is less error-prone because it uses some of our parser functions.

first(union(toStringList(^%{parent.aaaaa}), toStringList(^%{parent.bbbbb})))

 

 

  • Regarding the Single issue picker error, at the moment JWT cannot set that field, only read it, so it's not possible to achieve this requirement with our app.

 

However, I can confirm that both this bug and this new feature are already being work on and their fixes will be released as soon as possible.

In the screenshot below you can see an example on how the post-function could look like.

createIssueMultiUser.png

I hope this helps.

Cheers,

Sergio.

Pierre Ibrahim
Contributor
May 18, 2022

Thank you so much @Sergio del Pino _Decadis AG_ ! I appreciate the detailed response. Is there a ticket I can follow for the fixes being released please?

 

Thank you,

Pierre

Sergio del Pino _Decadis AG_ May 18, 2022

Hi @Pierre Ibrahim

We do not have an external ticket for the fixes, however, if you want I can let you know when they are being released right in this ticket.

Although I would recommend you to create a ticket in our customer portal letting us know about both of this errors, where it will be easier for us to let you know about the releases.

Cheers,

Sergio.

Like Pierre Ibrahim likes this
Pierre Ibrahim
Contributor
May 18, 2022

Hi @Sergio del Pino _Decadis AG_ ,

I'll go ahead and create a ticket.

Would you mind letting me know what the release date will be as well please?

Thank you

Pierre

Pierre Ibrahim
Contributor
August 16, 2022

Hi @Sergio del Pino _Decadis AG_

Wondering if I can pick your brain again on this same issue. I'm trying to set the Assignee of the created ticket using the same function that you explained:

first(union(toStringList(^%{parent.aaaaa}), toStringList(^%{parent.bbbbb})))

But adding to that a third field that's a single issue picker, not a multi issue picker like the original fields. The expression I'm trying to use is:

first(union(union(toStringList(^%{parent.aaaaa}), toStringList(^%{parent.bbbbb})), toStringList(^%{parent.ccccc})))

 since a union only does two lists so I'm unioning a union.

Now the other thing I tried is not do the toStringList since my understanding is that this function takes a list and converts it to a string list, however the single issue picker is not a list.

 

Now my expression returns the correct results when I test it, but I can't save the expression because JWT doesn't think it's a valid expression. The error I get if I click the red exclamation mark next to the expression is:

PARSE ERROR: "^%{ccccc}" is not a valid Multi-Valued field identifier, i.e., Multi-Select, Checkboxes, Multi-User, Multi-Group, Versions, Labels, Components, Issues or Attachments.

 Any guidance to what I'm doing incorrectly would be greatly appreciated.

Vicente Domínguez _Decadis AG_
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.
August 17, 2022

Hi @Pierre Ibrahim,

If you need to create a text list composed by two multi-valued fields and a single value field, follow these instructions:

  • Write the different custom fields from the seed issues between brackets [] in a comma-separated series to create a string list.
  • Convert it to a string and then to a string list again with toString() and toStringList() .
  • Use the function distinct()  to avoid repetitions among the elements of the string list.
  • Convert it again to a string so that it can be read by the JWT expression editor.

This expression would be written as follows:


toString(distinct(toStringList(toString([^%{parent.cfaaaa}, ^%{parent.cfbbbb}, ^%{parent.cfcccc}])))) 

We hope that this response was helpful.

Regards,

Vicente

Like Pierre Ibrahim likes this
Pierre Ibrahim
Contributor
August 17, 2022

Hi @Vicente Domínguez _Decadis AG_ , 

A variation of your solution worked for me, thank you!

For anyone else that may need this in the future with a use case like mine, Vicente's expression gets a list of all the values from the array. However since I'm putting this in the Assignee field I only want one result to return, the first result. 

first(distinct(toStringList(toString([^%{parent.cfaaaa}, ^%{parent.cfbbbb}, ^%{parent.cfcccc}]))))

Vicente's response explains the different operators used perfectly, the only variation I did is instead of enclosing everything in a "toString()" I enclosed in a "first()" instead. That returns the first result of the resulting array and does not cause a parse error. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events