Although I can see error in catilina.out of JIRA but I want the user to stop making such change (psd < srsd) in case he tries to something like that.
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.event.issue.AbstractIssueEventListener
import com.atlassian.jira.event.issue.IssueEvent
import com.atlassian.jira.project.Project
import com.atlassian.jira.workflow.WorkflowException
public class Pdrtst_test extends AbstractIssueEventListener {
@Override
void workflowEvent(IssueEvent event) {
this.customEvent(event)
}
@Override
void customEvent(IssueEvent event) {
Issue issue = event.issue
ComponentManager componentManager = ComponentManager.getInstance()
def customFieldManager = componentManager.getCustomFieldManager()
def cf1 = customFieldManager.getCustomFieldObjectByName("Prod Scheduled Date")
def psd = issue.getCustomFieldValue(cf1)
def cf2 = customFieldManager.getCustomFieldObjectByName("SIS Tech Review Start Date")
def srsd = issue.getCustomFieldValue(cf2)
if (psd < srsd){
invalidInputException = new InvalidInputException("customfield_id_10491","Prod Sch date should be greater than SIS date")
}
}
}I have put this script in script-listener and have set its Event as All events.
How can i achieve this ?
I want to show error on JIRA UI and stop user from making such change .