You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
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)
Script can be found here:
_________________________________________________________________________________________
import com.opensymphony.workflow.InvalidInputException;
import com.atlassian.jira.component.ComponentAccessor;
import java.text.SimpleDateFormat;
try{
//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;
switch(requestType){
case requestInternalMove:
noOfDays = requestInternalMoveDays
break;
case accessNewBadge:
noOfDays = accessNewBadgeDays
break;
case requestAccessOutOfBusinessHours:
noOfDays = requestAccessOutOfBusinessHoursDays
break;
case requestO365Team:
noOfDays = requestO365TeamDays
break;
case EnableDailyTravelPassport:
noOfDays = EnableDailyTravelPassportDays
break;
case rentVan:
noOfDays = rentVanDays;
break;
case requestecOnboarding:
noOfDays = requestecOnboardingDays
break;
case requestIOnboarding:
noOfDays = requestIOnboardingDays
break;
case requestCOnboarding:
noOfDays = requestCOnboardingDays
break;
case rentVan:
noOfDays = rentVanDays
break;
case requestDeskConsultant:
noOfDays = requestDeskConsultantDays
break;
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"
if(noOfDays>0){
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;
log.error(text)
}
//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"
if(noOfDays>0){
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")
log.error(ex.getMessage())
}
static Date getWorkingDaysDate(int days){
Date date=new Date();
Calendar calendar = Calendar.getInstance();
//calendar.add(Calendar.DAY_OF_YEAR, days-1);
date=calendar.getTime();
SimpleDateFormat s;
s=new SimpleDateFormat("MM/dd/yy");
//log.error(s.format(date));
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);
}else{
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)
{
i++;
}
}
date=calendar.getTime();
//s=new SimpleDateFormat("MMM dd, yyyy");
// log.error(s.format(date));
return date;
}
_______________________________________________________
can someone help?
Kind regards,
Matt
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.
[1]
invalidInputException = new InvalidInputException("--- Error with xxxx.... ---");
[2]
throw new InvalidInputException("--- Error with xxxx.... ---");
Unfortunately both do not work properly!
PS:
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.