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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

subtask validation from parent's field used JMWE

Edited

Hi guys,

I have 3 field :

1.  Vendor (A) : Text Field (multi-line) 12038
2.  Developer (B) : User Picker (multiple users) 12443
3.  SQA (C) : User Picker (multiple users) 12444

fields will be filled in Parent workflow,

I will make validation in sub-task used Linked Issues Validator (JMWE app)

Status Movement from open to in progress if :

A Empty + B Empty +C Empty= stop
A Empty + B filled +C Filled = move
A filled + B filled +C Filled = move
A filled + B Empty +C Empty = move

but I try my script and the result not same with my needs

(linkedIssue.customfield_12038 == null && linkedIssue.customfield_12443.length == 0 && linkedIssue.customfield_12444.length == 0)
||
(linkedIssue.customfield_12038 == null && linkedIssue.customfield_12443.length > 0 && linkedIssue.customfield_12444.length > 0)
||
(linkedIssue.customfield_12038 != null && linkedIssue.customfield_12443.length > 0 && linkedIssue.customfield_12444.length > 0)
||
(linkedIssue.customfield_12038 != null && linkedIssue.customfield_12443.length == 0 && linkedIssue.customfield_12444.length == 0)

the result  :

A Empty + B Empty +C Empty= stop
A Empty + B filled +C Filled = move
A filled + B filled +C Filled = move
A filled + B Empty +C Empty = stop


Capture.JPG

please help me for corrections related to what i have made

Regards,
Tyas

1 comment

Hi @Tyas Iglecias ,

that's probably because, when a multi-user picker field is empty, it doesn't return an empty list but null. Therefore, you should not test the length against 0 but the field against null. Also, your first test is incorrect, since it will pass if all 3 fields are empty. Generally, you need to think in terms of every case where the validator should pass.

(linkedIssue.customfield_12038 == null && linkedIssue.customfield_12443 != null && linkedIssue.customfield_12444 != null)
||
(linkedIssue.customfield_12038 != null && linkedIssue.customfield_12443 != null && linkedIssue.customfield_12444 != null)
||
(linkedIssue.customfield_12038 != null && linkedIssue.customfield_12443 == null && linkedIssue.customfield_12444 == null)

Hi @David Fischer _Appfire_ ,

After used your script, result is :

A Empty + B Empty +C Empty= move
A Empty + B filled +C Filled = move
A filled + B filled +C Filled = move
A filled + B Empty +C Empty = move

Are there any settings I missed?

Apparently, Jira expressions return "" for an empty multi-line text field (instead of null). Therefore, the script should be:

(!linkedIssue.customfield_12038 && linkedIssue.customfield_12443 != null && linkedIssue.customfield_12444 != null)
||
(!!linkedIssue.customfield_12038 && linkedIssue.customfield_12443 != null && linkedIssue.customfield_12444 != null)
||
(!!linkedIssue.customfield_12038 && linkedIssue.customfield_12443 == null && linkedIssue.customfield_12444 == null)
Like Tyas Iglecias likes this

Comment

Log in or Sign up to comment
TAGS
Community showcase
Published in Confluence Cloud

🎨 Add some visual life to your templates

Hi Atlassian Community, My name is Avni Barman, and I am a Product Manager on the Confluence Cloud team. Based on feedback from you, we are giving admins more power to create templates that a...

103 views 1 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you