Hi,
I want to build a global automation rule that uses an 'If/Else condition' component to fill a specific field only if the field exists on the issue screen. Else - If the field does not exist, the rule should not attempt to fill it.
Currently, I am encountering an error message: 'The set fields may be unavailable for this project/type'
How can I build this rule correctly?
Hi Eliyahu,
You should add a context to the custom fields so that they only apply to the appropriate projects and/or issue types first. That will enhance performance for your system and will take care of the need to try to handle with the automation rule.
Hi @John Funk ,
Thank you for your response. I checked the context for the custom fields, and it seems to be set correctly. However, I am still encountering the error message in the automation rule: "The set fields may be unavailable for this project/type."...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You still need to add the field(s) to the Edit screen (and/or Create screen). They just won't run for the issue types/projects that are not in the context.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That is likely possible by calling the REST API endpoint (with the Send Web Request action) to get the create issue metadata for the specific project and issue type, and checking if the "set" operation is available. Other than checking for a single field, that seems quite elaborate just to prevent a rule error.
Another alternative is if you know the issue type, the rule could use dynamic JSON to add (or not add) the field.
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy
Thank you for your response. I appreciate the suggestions you provided. Could you please elaborate and provide examples on how to implement each of the two alternatives you mentioned?
Using the REST API:
Using Dynamic JSON:
Thank you for your assistance!
Kind regards,
Eliyahu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I recommend performing the research necessary for either of these methods, and then experimenting to try them. As a reminder, the Atlassian Community is a place for people to learn and collaborate. It is not a source to provide turnkey solutions upon demand. Please work with your Jira Site Admin to learn more.
Regarding sources to get you started trying those suggestions...
1) Please read this article on calling the Jira REST API endpoints from a rule: https://community.atlassian.com/t5/Jira-articles/Automation-for-Jira-Send-web-request-using-Jira-REST-API/ba-p/1443828
Then review the REST API endpoints to learn how to find the issue metadata: https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/
2) Using rule conditions or conditional logic, your rule could build a dynamic JSON expression for the specific fields, storing that in a created variable. Here are some sources to help learn how to do that:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy
First of all, thank you very much for your help and guidance.
Secondly, You are right - I greatly appreciate research, testing, trial, and fix. This is also how I usually operate as a Jira admin.
The reason I asked for more details is that I am familiar with the methods you described and have used them in various cases. However, I couldn't figure out how to apply what you wrote to implement the solution.
Thank you very much for your help.
Best regards,
Eliyahu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No worries, and here are more details:
After calling the REST API to get the metadata, use dot-notation and a conditional expression, or the match() function with regex, on the web response body to determine if the specific field is present, and if the desired operations are present. Please try doing this incrementally, using the Log action to write results to the audit log as you start with just the web response, adding conditions / searches to it, until you get the desired result.
I have not needed this scenario before, and so I would essentially need to build and test it fully to offer more details.
For the JSON approach, that is simpler if you know a specific issue type does / does not support the field. Then the JSON could be stored in a Created Variable for use. For example:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.