Set assignee field with user in Project Role of another project.
Scenario: Project ProjA has the role "Point of Contact" and to this role, it was assigned just one single JIRA user.
Let's consider one of these issues of ProjA, named IssueA.
In Project ProjB I create a new issue (let's name it IssueB) and there is an "Issue Link" relationship between these two issues as:
IssueB ------- "Is defect for" --------- IssueA
and this link is unique, for IssueB (in the sense that there is no other "Is defect for" link inside this issue).
Problem: I want to set as Assignee of IssueB, the user that holds the Project Role "Point of Contact" in Project A.
I tried to use your function leastBusyUserInRole ("Point of Contact", ProjA) to assign it to "Ephemeral Value 1" and then set Assignee with "Ephemeral Value 1", but your Check Syntax return Syntax error inside leastBysyUserInRole, complaining about the first double quote sign.
Thanks in advance for your support.
By the way, if it helps, I agree to set the "Point of Contact" user inside a custom field in IssueA when it is created, them just set the IssueB Assignee with the value of this custom field of IssueA, it it eases the task.
Comments (8)
-
repo owner -
reporter Thanks, Fidel. I tried to use the same clue you gave above to initialize some custom fields of IssueB with values that belong do IssueA. Then, I used "Copy a parsed text to a field" with these parameters, without success:
Target field: Sistema Parsing mode: Advanced Text to be parsed:
"first(fieldValue(" + %{10025} + ", linkedIssues('Is defect for')))"
where %{10025} is the field from IssueA that must be assigned to IssueB (and both field types are the same), but the assignement was NOT successful.
Then, I tried a second option, with the "Read Fields From linked issues or subtasks" with this parametrization:
Target fied: Sistema Filtering by Issue Link Type: Is defect for Filtering linked issues or subtasks by issue type: Caso de Test
And this time, it worked fine. BUT my doubt is: this function worked fine, only because at the time it was executed, I am sure that there was only (and only) one IssueA linked to IssueB . This allowed the correct value to be taken from origin to be assigned to the destination.
To avoid this and make my code more "strong", I tried to use your suggestion, because on it, you used a function named first() that grants that only the first occurrence of this link will be used, even if I have lots and lots of other links of the same time.
So, I'd ratter use your "Copy a parsed text to a field" and not mine "Read Fields From linked issues or subtasks" . But I'm not able to understand what went wrong with your suggestion.
Thanks again. Antonio.
-
reporter Just complementing my previous messagem:
Is there a way to debug the expression
"first(usersInRole('Point of Contact'," + %{00018} +"))"
to understand why it didn't work?
-
repo owner Hi @acelsoddbr,
Your expressions are syntactically correct, and for that reason you don't get errors, but they don't work because you are all what you write between double quotes is considered a string literal, i.e.,
"first(usersInRole('Point of Contact',"
is a string literal, and neitherfirst()
norusersInRole()
are evaluated as functions.Try these 2 expressions instead:
first(fieldValue(%{10025}, linkedIssues("Is defect for")))
and
first(usersInRole("Point of Contact", %{00018}))
-
reporter And I must write the two expressions above under basic or advanced parsing mode? Because when I select Advanced parsing mode, JWT automatically puts two double quote signals at the multiline box where we must write down the expressions. So, if Advanced mode must be used, do I must remove these two double quotes before starting typing the expressions?
-
repo owner Hi @acelsoddbr,
When you change from basic to advanced parsing mode, JWT automatically converts the text in basic mode to advanced parsing mode syntax. The thing is that those expressions mean nothing in basic parsing mode, but a string literal. For that reason they are surrounded by
"
when we change from basic to advanced parsing mode.This is what you should do:
- Select advanced parsing mode.
- Empty parameter Text to be parsed..., and copy+paste one of the expressions I provided to you.
-
reporter Hi, @fcarmario ,
It works fine, now! Thank you very much!
Antonio.
-
repo owner - changed status to resolved
You are welcome.
- Log in to comment
Hi @acelsoddbr,
You can use "Copy a parsed text to a field" in a transition of the workflow used by Issue B with the following configuration:
where
%{00018}
is project role for Project key.