If the change category (custom field xxx) is "abc" or "xyz":
- The end date (custom field aaa) should be less than or equal to 20 days from the start date (custom field bbb).
For any other category:
- The end date (custom field aaa) should be less than or equal to 2 days from the start date (custom field bbb).
I tried both below scripts with build your own validator
Trial 1
if (issue.customfield_xxx?.value == "abc" || issue.customfield_xxx?.value == "xyz")
{
return issue.customfield_aaa <= (issue.customfield_bbb + "20d");
} else {
return issue.customfield_aaa <= (issue.customfield_bbb + "2d");
}
Trial 2
(issue.customfield_xxx!= null && (issue.customfield_xxx[0].value == "abc" || issue.customfield_xxx[0].value == "xyz") && (issue.customfield_bbb != null) && (issue.customfield_aaa != null)
(issue.customfield_aaa[0].value <= (issue.customfield_bbb[0].value + (20 * 24 * 60 * 60 * 1000)))
Both throws error even I set date below 20 days. Can someone please spot what I am missing
Note: I am trying this in Workflow validator