How do I validate ConfiForms Jira form field value for Jira Issue?

Adrian M February 20, 2024

I have a ConfiForms Jira form field that is shown on the form when a certain selection is made from another dropdown. Else it is hidden. Hence this field cannot have the 'Required' checkbox selected. There is validation that will show a form error if the field is empty.

To select and submit a Jira issue;

  1. The user can input the Jira key e.g. ABCD-1234.
  2. The located Jira issue is shown under the textbox (issuekey, summary and status)
  3. The user clicks the issue to select it.
  4. The issue that is selected then appears in the textbox
  5. User submits the form.
  6. This form Jira field value is saved in the Description field in Jira

If the user types in the Jira key e.g. ABCD-1234 but does not click to select the issue, then:

  • The validation for empty field does not get triggered as the validation sees a value in there.
  • However this value, that is in the form field, does not get saved to the description field. That part of the description field text is blank.
  • If the user does click to select the Jira issue then the description saved in Jira is only the issuekey as the value. Summary and status does not get saved.

How can I do the following?

  1. Validate that the form is not empty such that it contains a selected Jira issue and not just a typed in value or no value.
  2. Save the Jira issuekey, summary and status to the Jira description field.

1 answer

0 votes
Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 22, 2024

Hi @Adrian M 

Is this a question about the ConfiForms? I believe so, but nothing tells me that for sure (no tags, no mentioning of ConfiForms...)

Alex

Adrian M February 22, 2024

Sorry yes, this is about ConfiForms. I've added the tag now.

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 22, 2024

Ok, thanks for clarifying

You can add a conditional validation (Validate rule) for the "Jira field" to report when it is empty (not selected from the offered choices)

Alex

Adrian M February 22, 2024

I am using 'Conditional validation for required field' as follows. getting the same result. If a value is typed in the textbox and not selected then the validation action does not get executed but no value from that field gets saved to Jira.

The user should select a value from the CSPJiraTicket Jira field and that should get saved to the Description field in Jira. Else a form error message is displayed.

 image.pngimage.png

Adrian M March 25, 2024

@Alex Medved _ConfiForms_ I'm still trying to resolve this. I created a very simple form with a similar structure of my live form and I'm able to duplicate the issue.

Form has two fields. Summary set as required. And "Jira Issue" field has validation if field is empty.

image.png

image.png

image.png

----------------------------

On clicking the button with no value in the Jira Issue field the validation is triggered

image.png

----------------------------

Enter a Jira key in the Jira Issue field. Click to select the Jira Issue from the dropdown. Click the submit (Create Jira Issue) button. Issue is successfully created with "Jira Issue" field value in description field in Jira.

image.png

image.png

--------------------------------

Enter a Jira key in the Jira Issue field. Do not click to select the Jira Issue from the dropdown. Click outside the box. Click the submit (Create Jira Issue) button. Validation if empty does not get triggered. Issue is successfully created in Jira but "Jira Issue" field value is not in description field in Jira.

image.png
image.png

----------------------------------

How can I validate that the "Jira Issue" field has a valid Jira Object value?

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 25, 2024

Hi @Adrian M 

In ConfiForms version 3.10 we have introduced a property that you can ask from a Jira field to see if that "exists" (links to a valid Jira issue)

That could be then used in the Validation rule, in the condition

JiraIssue.exists:false

Alex

Like Adrian M likes this
Adrian M June 18, 2024

Hi @Alex Medved _ConfiForms_ 

This is my Validation : (JiraTicket:[empty] OR (!JiraTicket:[empty] AND JiraTicket.exists:false))

 

#1

Input field has no value

Result on Submit - Validation error message is shown

 

#2

Input field has a Jira Issue selected

Result on Submit - No Error

 

#3

Input field value is - XXXX

Error message below Jira field - "Request could not be completed: Status: 404 with message: and response: '{"errorMessages":["Issue Does Not Exist"],"errors":{}}'"

Result on Submit - No validation error message is shown and form can be successfully submitted

For scenario #3 how can the form submission be prevented and show the validation error message instead?

Note: 

1) This Jira issue form field value is being saved in the description field in Jira and not an issue field in Jira. So Jira wont throw an error if no/invalid value is passed, in this case.

2) The documentation states "myfield.exists - returns true or false to verify if the value stored in this field corresponds to Jira issue". It is not clear what it will return if a String or Null value is passed to JiraTicket.exists

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 18, 2024

Checking for JiraTicket.exists:false should be sufficient

No other expressions needed

Adrian M June 18, 2024

Validation - JiraTicket.exists:false

Validation error message is not shown when no value (empty) is passed and form can be successfully submitted.

Validation message is shown when String (e.g. XXXX) is passed.

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 18, 2024

JiraTicket:[empty] OR JiraTicket.exists:false

Like Adrian M likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events