Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

JMWE field validation is not working

_Ekta Lala
January 13, 2026

Immaterial below condition is fatse or true, error msg is thrown. Can you help how to make it work. I am using this script in build your own validation to check current issue date is before than parent issue. 

 

let convertToNumber = x => x ? Number(x) : 0;
let convertToCalendarDate = x => x ? new CalendarDate(x) : null;
let convertToDate = x => x ? new Date(x) : null;
let convertCalendarDateToDate = x => x ? new Date(x.toISOString() + "T00:00:00") : null;
let convertDateToCalendarDate = x => x ? x.toCalendarDate() : null;

// Correct type check for RichText
//let convertRichText = x => x instanceof RichText ? x.plainText : x;
let convertRichText = x => typeof x == "RichText" ? x.plainText : x;

// Use issue.parent, not parent
let source = convertRichText(issue.customfield_11103);
let target = issue.parent != null ? convertRichText(issue.parent.customfield_11103) : null;

// Final comparison – make sure both sides are not null first, if needed:
source != null && target != null && source < target
//"source = " + source + ", target = " + target + ", comparison = " + (source <= target)

2 answers

Suggest an answer

Log in or Sign up to answer
2 votes
Marc -Devoteam-
Community Champion
January 13, 2026

HI @_Ekta Lala 

What is your goal.

What language is the script?

JMWE in cloud supports nunjucks language only, noy groovy?

_Ekta Lala
January 14, 2026

The purpose is to check a date of child issue from parent and create the child issue only if child.date < parent.date. 

 

BR
Ekta

 

 

Marc -Devoteam-
Community Champion
January 14, 2026

Hi @_Ekta Lala 

JMWE validation, condition and post-function are for actions in workflows.

What is you exact requirement, based on when and what a child issue should be created?

Also automation could provide a solution.

_Ekta Lala
January 15, 2026

Thanks Marc, You are right JMWE validation script worked in transition from "To DO" to "In progress". However, it is not showing any error. Just that movement is not possible due to workflow restrictions.

I want to check that story due date should be more that its parent due date ( we have customised date field here). If the date is later than parent date, an error should be thrown action should not be performed. 

 

Marc -Devoteam-
Community Champion
January 15, 2026

Hi @_Ekta Lala 

You can built your own validator.

Example code:

!issue.parent || (issue.dueDate != null && issue.parent.dueDate != null ? issue.dueDate <= issue.parent.dueDate : true)

 

0 votes
claudio_sales_nimbleevolution_com
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 21, 2026

Hello @_Ekta Lala , for this validator to work, it must be executed on the child issue, as the comparison is made between it and the parent issue. If both fields are filled in, validation is tested (true or false). If one of the issues does not have the field filled in, the return will be false.

if you use the native field Due Date

!!issue.parent.dueDate && !!issue.dueDate &&
issue.dueDate < issue.parent.dueDate

 if you use the custom field

!!issue.customfield_10109 && !!issue.parent.customfield_10109 &&
issue.customfield_10109 < issue.parent.customfield_10109

 

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events