need custom script validator

Pankaj May 11, 2023

Hi All,

I need to show error message :

When we move to resolved status in workflow.

If we select the resolution field is "Done" or "Completed" option then we need to show error message("Time Spent is required").

I have written this below script, but this script is working for all options, I need error message only when we select resolution's option "Done" or "Completed"

 

import com.atlassian.jira.issue.Issue
import com.opensymphony.workflow.InvalidInputException
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.CustomField

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def resolutionField = customFieldManager.getCustomFieldObjectByName("Resolution")
def resolutionFieldValue = issue.getCustomFieldValue("Resolution").getValue()

if(resolutionFieldValue == "Done" || "Completed"){
   throw new InvalidInputException("Time Spent is mandatory")

could you please help me where we have to change?

Thanks in Advance

0 answers

Suggest an answer

Log in or Sign up to answer