Our new Appfire Documentation Space is now live!

Take a look here! If you have any questions please email support@appfire.com

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

This article describes how to display a custom error message on the service desk request creation screen while using the Scripted Groovy validator. This is because Jira Service Desk does not display validator messages properly. (https://jira.atlassian.com/browse/JSDSERVER-5822). There are two approaches to handle this. In both the approaches, the configured error message is appended to the default error message of Jira.

Use ‘For Field’ and display message against the field

This approach is best suited when you are validating the field value. For example, you want to check during the request creation that the Component/s of the issue is “Database” only.

  1. In the Scripted Groovy Validator add the Groovy script. For example:

    issue.getAsString("components") == "Database"

  2. Input the Error message as The Components should be Database

  3. Select the Component/s field under “For field”

  4. Save the validator and publish the workflow

Now when you create the request from the portal the validation message “Please enter Component/s field” is appended to the default message.

Use Map<String,String> to display error message against fields

This approach is best suited when you want to display a different custom message for each condition. For example, while requesting an account you want to validate that an assignee is selected and belongs to a specific group. And you would want to return custom error messages based on the selections. Use Map<String,String> where each key is a field name or ID and the corresponding value is the error message to display for that field.

  1. In the Scripted Groovy Validator add the Groovy script.

    if(!issue.get("assignee"))
    ["assignee":"Assignee field is mandatory"]
    if (issue.getAsString("System") == "Billing Services" && !issue.assignee.isInGroup("billing"))
    ["assignee":"Assignee should belong to Billing Services group"]
    if (issue.getAsString("System") == "Financial Services" && !issue.assignee.isInGroup("finance"))
    ["assignee":"Assignee should belong to Financial Services group"]

  2. Save the validator and publish the workflow

Now when you create the request from the portal the validation message is appended to the default message.

  • No labels