Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to make Attachment field mandatory based on custom field value selection while creating issue?

k.vijaya.lakshmi February 8, 2024

How to make Attachment field mandatory based on custom field value selection while creating issue using script runner or any other way?

If you know the code please share.

2 answers

1 accepted

1 vote
Answer accepted
Sharumathy Krishnan
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 8, 2024

Hi @k.vijaya.lakshmi 

This can be achieved through workflow validator in the create transition. But you would need any of the third party plugin like JSU, JMWE, or JWT to do this. They have a validator called "Field Required" with the condition validation.

Hope this helps!

 

Thanks,

Sharu

Empyra Software Solutions

Suprija Sirikonda _Appfire_
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 8, 2024

Hi @k.vijaya.lakshmi,

If you've the Jira Misc Workflow Extensions (JMWE) app installed in your Cloud instance, you can very easily achieve your requirement by following below steps:

  1. Add JMWE's Field required validator on the create transition of the workflow.
  2. Select "Attachment" for "Field(s)"
  3. Select the checkbox "Conditional validation" under "Validator scope" and add the below Jira Expression:
    !!issue.customfield_10004 && issue.customfield_10004.value == "test"

Assuming the custom field (based on which you want the Attachment to be mandatory) is a select-list field: in the above script, replace 10004 with the ID of the custom field and test with the desired option of this field.

Let me know if the field is of a different type or if your requirement is different.

BTW, I'm from Appfire, the vendor of JMWE app.

Regards,

Suprija | Appfire

 

Vicente Domínguez _Decadis AG_
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 8, 2024

Hello @k.vijaya.lakshmi and thank you @Sharumathy Krishnan for mentioning us!

I am part of the support team of Decadis and I would like to offer you a possible solution with our app Jira Workflow Toolbox for Jira Cloud.

It would be possible to prevent transitioning issues with no attachments in the Create transition with the JWT for Cloud Fields required validator. There, it would only be necessary to select the Attachments field as required.

However, as the transition needs to be prevented only if another custom field has a value, our recommendation would be to use the Jira expression validator with an expression similar to the following one in the Create transition:

issue?.customfield_nnnnn != null ? issue?.attachments != [] : true

Please, note that the validation of the first field may vary depending on the type of field and the field ID. To adjust the first part of the expression, it might be useful to take a look at the use case Evaluate custom fields.

If you need more information about this or other implementations, please, do not hesitate to contact us in this thread or via our Support Service Desk or visit our documentation.

Best regards,

Vicente

0 votes
Suprija Sirikonda _Appfire_
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 8, 2024

Hi @k_vijaya_lakshmi,

If you've the Jira Misc Workflow Extensions (JMWE) app installed in your Cloud instance, you can very easily achieve your requirement by following below steps:

  1. Add JMWE's Field required validator on the create transition of the workflow.
  2. Select "Attachment" for "Field(s)"
  3. Select the checkbox "Conditional validation" under "Validator scope" and add the below Jira Expression:
    !!issue.customfield_10004 && issue.customfield_10004.value == "test"

Assuming the custom field (based on which you want the Attachment to be mandatory) is a select-list field: in the above script, replace 10004 with the ID of the custom field and test with the desired option of this field.

Let me know if the field is of a different type or if your requirement is different.

BTW, I'm from Appfire, the vendor of JMWE app.

Regards,

Suprija | Appfire

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events