-
Type:
Bug
-
Resolution: Not a bug
-
Priority:
Medium
-
Component/s: Forms - API
-
None
-
1
-
Severity 3 - Minor
Issue Summary
API request creation fails with a 422 error when the Summary field is marked as "Required" in both the JSM Form and the Request Type.
Steps to Reproduce
- In a JSM project, create a Form and add a Short Text field mapped to the Jira Summary field.
- Mark this field as Required within the Form.
- Ensure the Summary field is also required in the Request Type configuration (which is the default).
- Attempt to create a request via the REST API, providing the summary in requestFieldValues.
- Attempt to create a request via the REST APi, providing the summary in form.answers.
Expected Results
The API should recognize the summary provided in requestFieldValues or form.answers and satisfy both the form's or request form's requirement since they are linked.
Actual Results
When we pass the field through requestFieldValues we see the error as follows. In the example below, ID 7 represents the form field linked to the Summary field.
"errorMessage": "We couldn't submit your request because some fields have invalid entries. Review your entries and try again.", "errors": [ { "status": 422, "code": "UNPROCESSABLE_ENTITY", "title": "Form validation failure.", "detail": "Field is required", "context": [ { "type": "issue", "id": "unknown" }, { "type": "question", "id": "7" } ] } ], "i18nErrorMessage": { "i18nKey": "sd.request.create.error.proforma.form.validation.error", "parameters": [] } }
If we pass the field value in both places, we see the error:
{
"errorMessage": "Unable to create request because of these errors : The field 'summary' is not valid for this request type 'Accio'.",
"i18nErrorMessage": {
"i18nKey": "sd.request.create.error.failed.msg",
"parameters": [
"The field 'summary' is not valid for this request type 'Accio'."
]
}
}
Workaround
Send an empty requestFieldValues as shown below:
"requestFieldValues": {
}
(OR)
Mark the summary field as not required in Advanced forms. This way, we can pass the field through requestFieldValues, to create the request through API, and the portal creation will still throw an error when we try to submit it without the Summary field. Though the asterisk will be unavailable on the portal form.
- mentioned in
-
Page Loading...