Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Validation in due date on issue update event

I have applied the validation in due date field at the time of issue created event.

Logic:

When the ticket<task issue type> is created and due-Date is set to 10th January 2019. Then  Due Date <sub-task issue type> should be smaller than Due-Date<task issue type>

The validation rule is working fine at the time of creating the sub-task issue created event. 

The condition is provided below :

if(issue.parentObject.dueDate >= issue.dueDate )
{
issue.dueDate
}

But the validation is not working at the time of issue update event.

Also I am unable to apply the validation in due date field at the time of issue update event.  

Can anyone help me where and how to apply validation in issue update event. So that the validation will be working fine for issue update event.    

1 answer

0 votes
Andy Heinzer Atlassian Team Jan 03, 2020

Hi Kalyan,

If I understand your concern here, you have a workflow validator working when executing a transition that creates sub-tasks, but you also want this validator to be applied to issue update events that happen outside of a transition.

Unfortunately, the validators in Jira only are expected to work within the steps of a workflow (just before a transition is executed to be more precise).  More details on these can be found in Advanced Workflow Configuration: Validators

The way I would recommend trying to address this problem would be to adjust the screen configurations here.  If you remove that field from the view/edit screens of that issue type, and only leave that field on a transition screen, you can effectively prevent your users from just making changes to the field outside of the transition itself.  If your transition does not yet have a screen, you would have to create a new screen here and place that field in the screen.  This way users could still input data to that field and have it validated, but only immediately before a transition happens.

If you are unfamiliar with making a change like this, I would recommend that you consult the documentation Defining a screen.

I hope this helps. Let me know if you have any questions or concerns about this approach.

Andy

@Andy Heinzer:

Thank you so much for sharing the answer. I will implement as per your steps provided. But the only question i am having issue update permission that how to handle the permission scheme?By default, jira is not validating any custom field when agent click on edit button.  

Would you please check i had implement the script on script listener but i am facing issue on the same. I m searching for 4 days.

The two point is provided below which i need to fix:

1. I am unable to restrict for update the value of an issue at the time of issue update event. I had created a script on script listener.

2. Instead of hard coded value for key, i want to use dynamic code on script-runner. Means if the ticket is sub-task issue and project will be the same then the below script will execute.

Here the script is provided below and the requirement is duedate value for Task IssueType should be greater than the Duedate value for n number of subtask IssueType :

import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.Issue
import groovy.transform.BaseScript
import com.onresolve.scriptrunner.runner.customisers.ContextBaseScript
import com.onresolve.scriptrunner.runner.util.UserMessageUtil
import com.opensymphony.workflow.InvalidInputException

//

@BaseScript ContextBaseScript script

Issue issue = getIssueOrDefault("TEST-258") // Hard coded issue-key defined

if(issue.parentObject.dueDate.compareTo(issue.getDueDate()) >= 0)
{
UserMessageUtil.success("Due Date Success"+issue.dueDate)
log.debug(issue.getDueDate())
}
else
{
UserMessageUtil.success('Please enter the Subtask duedate that is less than Parent-Task Due-Date ')
//throw new InvalidInputException("Input not valid")
}

The problem is that when the condition fails then the Due-date will be update first and next the pop up alert is raised which i mentioned in the code but I am unable to restrict the due date update.

Also recommend us for second point on run-time environment(on production).

Due_Date_code_Listener.jpgTEST-247.jpgTEST-258.jpg

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Service Management

JSM June Challenge #2: Share how your business teams became ITSM rockstars

For JSM June Challenge #2, share how your non-technical teams like HR, legal, marketing, finance, and beyond started using Jira Service Management! Tell us: Did they ask to start using it or...

168 views 6 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you