Validate the parent ticket fields in subtask transition

Lakshmi S March 5, 2024

Hi Team,

 I have a requirement, 

If the "Team Manager" and "Team Manager - Validation" fields (both are user picker type fields)  on the parent ticket are empty,  Assign to the person on the "Team Manager - Validation" field in the Sub-Task ticket (copy the "Team Manager - Validation" to Assignee)

I used this copy field to field JMWE post function, but its not working. Is there any correction in the function.

((issue.get("Issue Type")?.name == " Parent Ticket") && (issue.getAsString("Team Manager") == " " && issue.getAsString("Team Manager - Validation") == " "))

1 answer

1 accepted

0 votes
Answer accepted
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 5, 2024

Hi @Lakshmi S 

I'll not sure I understand what you're trying to achieve. Could you please explain it with an example? Also, can you share the full configuration of the post function, not just a script without context?

Lakshmi S March 6, 2024

Hi @David Fischer ,

 Apologies for the confusion!

We have two user picker fields "Team Manager" and "Team Manager - Validation" on both parent and subtask.

If the "Team Manager" and "Team Manager—Validation" fields on the parent ticket are empty when a subtask moves to a particular transition, then the value of the "Team Manager—Validation" field on the subtask should be copied to the "Assignee" field.

 

 

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 6, 2024

Hi @Lakshmi S 

since the post-function is triggered by a transition of sub-tasks, the "current" issue in the post-function is the sub-task, and therefore the "issue" variable refers to the sub-task, not its parent.

Therefore, the conditional execution script should be:

issue.parentObject && !issue.parentObject.get("Team Manager") && !issue.parentObject.get("Team Manager - Validation")

Of course, I'm assuming the post-function is already configured to copy the "Team Manager—Validation" to the Assignee field. 

Lakshmi S March 7, 2024

Thank you so much @David Fischer . It's working as expected now.

Yes,  I added the post-function copy the "Team Manager—Validation" to the Assignee field, and added the above line of script in "Condition"

Suggest an answer

Log in or Sign up to answer