Hi All,
I have written a post function script to read the data form the linked ticket and then add the required data in to the current ticket. So, there is a need to update the due date of the current ticket form linked issue only if the due date of the current ticket is empty. I have written a block to check if the due date is null or not but this block is failing
if - will run if the due date is null or empty
else- will run if the due date is not empty
I have set the logs , the logs are saying the value of due Date is null but still the code is not triggering the if block
if(String_dueDate.isEmpty() == true || String_dueDate == null ||String_dueDate.length() == 0)
{
log.debug("In If And Parent Due is "+ issue2.getDueDate())
log.debug("Current Due is"+ issue1.getDueDate() )
issue1.setDueDate(due_Date_2_value);
}
else
{
log.debug("In Else And Parent Due is "+ issue2.getDueDate())
log.debug("Current Due is"+ issue1.getDueDate() )
}
I don't under stand what's wrong in the code.
I have converted the due date outcome to string as well and then I am comparing
def due_Date_1_value = issue1.getDueDate()
String String_dueDate = due_Date_1_value.toString()
Please help me to understand and fix this.
Thanks,
Rohit
There is no need to mess about converting to strings to do this comparison, and in fact, this is making it worse for you because you're comparing things that you've cast and not fully understood the results of the cast.
The most simple structure you could use here is:
def due_Date_1_value = issue1.getDueDate()
if ( due_Date_1_value )
{
// due date is filled, do nothing
}
else
{
// due date is empty, do stuff
}
Thanks NIC for your answer. Before updating the due date in the ticket I need to first check whether the due date for the ticket already updated. If it's empty then only update the due date.
That's the only reason for if and else clause.
Regards,
Rohit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I know that, that's why I gave you the code to do that.
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.
Validate your expertise in managing Jira Service Projects for Cloud. Master configuration, optimize workflows, and manage users seamlessly. Earn global 🗺️ recognition and advance your career as a trusted Jira Service management expert.
Get Certified! ✍️Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.