Can we display custom error in JQLfunction modules

I’m building a Forge app with a custom JQL function module, and I’d like to show custom error messages when a user enters invalid input or when my resolver logic fails validation.

For example:
If the user writes a query like

issue IN issueswithJqlnew("project == rws AND issuetype = task", "1")

I want to show something like

“Invalid Jql: please provide a valid JQL.”

Is there any way to throw or return a custom error message from within the JQL function code so that Jira displays it to the user in the JQL editor or results panel (instead of a generic error like ‘Error in the JQL Query’)?

If anyone has implemented custom validation or user-friendly errors in Forge JQL functions, I’d really appreciate some guidance or code examples.

Hey @AbhishekJoshi

You can use this component, you will have all errors displayed:

You can follow their examples, you can also use the autocomplete.

Currently I am doing this thing by backend only , I do not have any frontend part . Is there anything which help me in backend function .

Ok, I’m not 100% sure, maybe you can try with this API, and get the response from Jira, and use it as your error message:

https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-search/#api-rest-api-3-search-jql-get

As noted here you just need to return an object with the following format if you need a custom error message:

{
  "error": "Your custom error message"
}