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)
HI @_Ekta Lala
What is your goal.
What language is the script?
JMWE in cloud supports nunjucks language only, noy groovy?
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.