The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

Difference between today and custom date field

Himanshu Nanda
Contributor
November 26, 2020

Hi, Requirement - If 'Planned start date' (custom field) is less than two days from now, and 'Env' (custom field) is 'PRD', then only Emergency change category ticket can be created.

I'm writing a JMWE scripted workflow validation to achieve this (not a scripting expert)

if (issue.get("Env") == "PRD")
{ if ((issue.get("Change category") != "Emergency"))
{(issue.get("Planned start date") > new Date() +2)
}}

The problem with this is, that even if Change category is selected as Emergency, it does not allow the ticket creation. What am I doing wrong? Pls help.

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
David Fischer
Community Champion
November 26, 2020

Hi Himanshu,

I believe what you want is:

issue.getAsString("Change category") != "Emergency" || issue.getAsString("Env") != "PRD" || issue.get("Planned start date") > new Date() +2
Himanshu Nanda
Contributor
November 27, 2020

Had to make a slight logical adjustment to your recommendation, but worked like a charm. Thank you!

DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events