Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

Workflow validator is not showing the message passed in InvalidInputException

When running a validation script (scriptrunner) in the past we saw the message that was specified in InvalidInputException. Now instead we get a general error message and a system error on the right side of the screen. (see screenshot)

Image 141.png


Script can be found here:


import com.opensymphony.workflow.InvalidInputException;
import com.atlassian.jira.component.ComponentAccessor;
import java.text.SimpleDateFormat;

    //set the value of the customer request type of request Internal Move
    def requestInternalMove= "sd/d28a8b4a-343c-453c-9e87-68a1f7b2710d"
    int requestInternalMoveDays=14
    def accessNewBadge= "sd/9f504603-3714-41b4-9fb3-b34bcd281337"
    int accessNewBadgeDays=1
    def requestAccessOutOfBusinessHours= "sd/9b8df7fc-a58c-432b-9e1f-74916a8cce10"
    int requestAccessOutOfBusinessHoursDays=2
    def requestO365Team= "sd/9d3afd70-652c-4cb9-a4b5-b07773775a7e"
    int requestO365TeamDays=1
    def EnableDailyTravelPassport= "sd/018476f2-328d-46aa-b28f-9227160c9788"
    int EnableDailyTravelPassportDays=5
    def rentVan= "sd/ca7491e3-74b2-4352-87a2-173f3427e958"
    int rentVanDays=6
    def requestDeskConsultant= "sd/ecafb986-8d25-4dc4-a537-e845fb53869f"
    int requestDeskConsultantDays=10
    def requestecOnboarding = "sd/2eafbec9-9adb-4668-939b-a4e8d3ab5dfd"
    int requestecOnboardingDays = 5
    def requestIOnboarding = "sd/42cdd1f9-c57e-4b4e-a4b4-ace2d42b1ee5"
    int requestIOnboardingDays = 5
    def requestCOnboarding = "sd/09543f37-9810-4ccb-add6-83843ce9e066"
    int requestCOnboardingDays = 5

    def issueManager = ComponentAccessor.getIssueManager()
    def customFieldManager = ComponentAccessor.getCustomFieldManager()
    def cf = customFieldManager.getCustomFieldObjectByName("Customer Request Type")
    def cFieldValue = issue.getCustomFieldValue(cf)
    log.error("Customer Request Type: " + cFieldValue);
    def requestType = cFieldValue.toString();
     int noOfDays = 0;
        case requestInternalMove:
            noOfDays = requestInternalMoveDays
        case accessNewBadge:
            noOfDays = accessNewBadgeDays
        case requestAccessOutOfBusinessHours:
            noOfDays = requestAccessOutOfBusinessHoursDays
        case requestO365Team:
            noOfDays = requestO365TeamDays
        case EnableDailyTravelPassport:
            noOfDays = EnableDailyTravelPassportDays
        case rentVan:
            noOfDays = rentVanDays;
        case requestecOnboarding:
            noOfDays = requestecOnboardingDays
        case requestIOnboarding:
            noOfDays = requestIOnboardingDays
        case requestCOnboarding:
            noOfDays = requestCOnboardingDays
        case rentVan:
            noOfDays = rentVanDays
        case requestDeskConsultant:
            noOfDays = requestDeskConsultantDays
        default : noOfDays = 0;
     Date date = getWorkingDaysDate(noOfDays)
     log.error("validation date: " + date);
    //Check if the due date is later than the 2 weeks
    if (issue.dueDate?.before(getWorkingDaysDate(noOfDays))) {
        def text ="Due date can't be in the past"
            text = noOfDays + " day(s) are required to provide this service, please provide a date after " + date.format( 'dd-MMM-yyyy' )
        throw new InvalidInputException(text)
        //invalidInputException = new InvalidInputException(text)
        return false;
    //validate date start date if available
    def cfStartDate = ComponentAccessor.customFieldManager.getCustomFieldObject("customfield_10703") //Customer Request Type
    Date startDateValue = (Date) issue.getCustomFieldValue(cfStartDate)
    log.error( issue.dueDate.toString());    
     log.error( startDateValue.toString());
    /* Custom field with the value to filter on */
    if (startDateValue && startDateValue != null) {
        if (startDateValue?.before(getWorkingDaysDate(noOfDays))) {
        def text ="Due date can't be in the past"
            text = noOfDays + " day(s) are required to provide this service, please provide a date after " + date.format( 'dd-MMM-yyyy' )
        throw new InvalidInputException(text)
        log.error("SART DATE: "+ text)
            return false;
    //validate end date if available
    def cfEndDate = ComponentAccessor.customFieldManager.getCustomFieldObject("customfield_10704") //Customer Request Type
    Date endDateValue = (Date) issue.getCustomFieldValue(cfEndDate)
    if (endDateValue && endDateValue != null) {
        if (endDateValue?.before(startDateValue)) {
        def text ="Due date can't be before start date"

        throw new InvalidInputException(text)
        log.error("END DATE: "+ text)
            return false;
}catch(Exception ex){
    invalidInputException = new InvalidInputException("An error ocured please contact the helpdesk")

static Date getWorkingDaysDate(int days){
    Date date=new Date();
    Calendar calendar = Calendar.getInstance();
    //calendar.add(Calendar.DAY_OF_YEAR, days-1);
    SimpleDateFormat s;
    s=new SimpleDateFormat("MM/dd/yy");

    int forDays = days;
    if(days < 0){
        forDays = days * -1;
    for(int i=0;i<forDays;)
        if(days > 0){
            calendar.add(Calendar.DAY_OF_MONTH, 1);
            calendar.add(Calendar.DAY_OF_MONTH, -1);
        //here even sat and sun are added
        //but at the end it goes to the correct week day.
        //because i is only increased if it is week day
        if(calendar.get(Calendar.DAY_OF_WEEK)<Calendar.SATURDAY && calendar.get(Calendar.DAY_OF_WEEK)>Calendar.SUNDAY)

    //s=new SimpleDateFormat("MMM dd, yyyy");
   // log.error(s.format(date));
    return date;


can someone help?


Kind regards,



2 answers

We are also affected by this issue with the input validation which has worked quite good in the past already!

I tried two variants, both lead to a generic input error but do not show the exception message as before.



invalidInputException = new InvalidInputException("--- Error with xxxx.... ---");



throw new InvalidInputException("--- Error with xxxx.... ---");


Unfortunately both do not work properly!



Used JIRA version is 7.7.2 with Service Desk 3.10.2, ScriptRunner 5.3.13.


I have the same problem, after upgrading jira to 7.13.

Any solution or workaround?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

70 views 1 6
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