Hello,
We would like to set "Preliminary Estimate" field is required when we select "Epic Type" field as 'Production Work' (in drop down options).
To achieve this we are trying to use behaviour function but I don't have much knowledge on Script, Could anyone help and provide the right script to setup this feature.
Note: " We are using Jira Cloud not Jira Server, Behaviour feature is now available for Jira cloud "
Thank you
Balaji
Hi, @Velkuri Balaji
Try this:
const preliminaryEstimateField = getFieldById("customfield_12345");
const epicTypeField = getFieldById("customfield_54321");
if (epicTypeField.getValue().name == "Production Work") {
preliminaryEstimateField.setRequired(true);
};
More information on behaviours can be found here:
https://docs.adaptavist.com/sr4jc/latest/features/behaviours
and here:
https://www.youtube.com/playlist?list=PLnsCytbU4bI6SwVAp1DJlzua9vk1oLQ-G
Hi @Evgenii
Thank you for your quick reply, It is working on issue creation level, If we select Epic Type as 'Production Work' it is asking to fill 'Preliminary Estimate' field and if we select Epic type as ' Testing' then 'Preliminary Estimate' Field is not required to fill which looks good.
However, After create an issue by selecting Epic Type as 'Testing' in edit screen users are able to change Epic type field as 'Production Work' here it's not showing required to fill 'Preliminary Estimate' field
Example :
While creating issue users can select Epic type as 'Testing' and after that they will open issue and change the Epic Type as ' Production Work' and here they are Skipping the Preliminary Estimate Field.
Could you please suggest how to achieve it.
Thank you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, you have to make behaviour that looks for field changes on issue creation and on changes in issue. Add to behaviour field "Epic Type" and in script section in use something like this:
const changedField = getChangeField();
const preliminaryEstimateField = getFieldById("customfield_12345");
if (changedField.getName() == "Epic Type") {
if (changedField.getValue().name == "Production Work") {
preliminaryEstimateField.setRequired(true)
}
}
Here is example, how it can be made:
https://youtu.be/T_22rKXWNrg?list=PLnsCytbU4bI6SwVAp1DJlzua9vk1oLQ-G
Not sure, that it will help, haven't found exact example. But in server Jira it works nearly that way.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Evgenii
Thank you for your time and efforts,
I have tried above script to affected field as Epic Type but still it doesn't work on the edit screen level. Could you please correct me if I'm doing somewhere wrong
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Click ... in actions column in epic type row, then edit. There you will see section for code. Slightly fixed code, because as I see your field name is in lowercase.
const changedField = getChangeField();
const preliminaryEstimateField = getFieldById("customfield_12345");
if (changedField.getName() == "epic type") {
if (changedField.getValue().name == "Production Work") {
preliminaryEstimateField.setRequired(true)
}
}
Logic is, that when field is changing, this script looks for changes, and if changed field name == "epic type", it checks vor field value.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Evgenii
Sorry for the late response, really appreciate for your efforts, I have updated script as above but still after create issue we can change the epic type at this point it's not asking to fill Preliminary Estimate Field
Small update : I have replaced epic type values as below
Production Work = Product Innovation
Testing = Product Improvement
While creating issue I can choose 'Epic Type' as Product Improvement so that i can skip Preliminary Estimate Field and after that I can Open issue and Change the 'Epic Type' to Product Innovation and it's not asking fill Preliminary Estimate Filed.
Please check the below picture with highlighted areas
Great appreciate on your help
Thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We have create issue screen and while we create issue we can choose ' Epic Type' as Product Improvement in this case not required to fill ' Preliminary Estimate' Field and after issue created we can open issue and if we choose the 'Epic Type' as 'Product Innovation' it's not asking to fill 'Preliminary Estimate' Field (Edit Screen Level), but we are expecting it must ask to fill 'Preliminary Estimate' field.
Is this possible to achieve ? I hope you understand my requirement.
Thank you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, I understood. Problem is that behaviour works with screens.
When you're editing field in created issue - no additional screen for editing is shown, so behaviour can't catch changes and influence on fields on screen.
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.