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:Ā 

Validation IF field was previously populated with xxx date

Rob B
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
March 1, 2022

Is it possible to put a validation IF a field WAS populated with a certain date?

The field are cleared down at a point - Hence the "was populated with"

Thanks

3 answers

2 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

2 votes
Answer accepted
Sachin Dhamale
Community Champion
March 1, 2022

@Rob B ,

This can be done by scripted validator.

Script will be - To check the issue history  for the custom field object there you can check the that field had a specific value or not.

In the script you need use getChangeItemsForField  function which will give you the change history for that custom field which you need to iterate and in the for look you can compare the history values.

Accept the Answer if it helps

0 votes
Answer accepted
Rob B
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
March 2, 2022

Hi Guys,

Sorry that doesnt really help me. Im a beginner.

 

Thanks

Rob

Sachin Dhamale
Community Champion
March 2, 2022

@Rob B 

Refer this Video  which explain how you can get the history

 

import com.atlassian.jira.component.ComponentAccessor

def issueManager = ComponentAccessor.issueManager
def changeHistoryManager = ComponentAccessor.changeHistoryManager
def projectManager = ComponentAccessor.projectManager
def project = projectManager.getProjectByCurrentKey("MOCK")

def issues = issueManager.getIssueObjects(issueManager.getIssueIdsForProject(project.id))

issues.each { issue ->
log.warn "${changeHistoryManager.getAllChangeItems(issue)}"
}
Like • Rob B likes this
Rob B
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
March 2, 2022

Thanks Sachin

0 votes
Mohamed Benziane
Community Champion
March 1, 2022

Hi @Rob B 

Do you mean put a workflow validator based on the previous value in your customfield ?

I think you can do it you'il need to get the history of your issue

https://docs.atlassian.com/software/jira/docs/api/7.0.5/com/atlassian/jira/issue/changehistory/ChangeHistoryManager.html#getChangeItemsForField-com.atlassian.jira.issue.Issue-java.lang.String-