Hi Community,
I am creating a behavior in Jira Cloud using scriptrunner.
I want to hide a custom field based on workflow status using scriptrunner cloud behaviors:
For example: custom field as "Service" and status as "To Do", so when an issue reaches to status "To Do" then the custom field "Service" should be hidden on the view screen.
Please guide further with the required code.
Thanks
I'm no export, but a quick scan on the behaviours documentation shows that status information can only be used by the status id, not the name.
See, behaviours-supported-fields-and-products
But only on Jira and Company Managed projects, so no JSM and Team Managed projects
Thank you so much for sharing that useful document, it helped me to configure the getValue logic in scriptrunner cloud behavior.
I also referred to these help documents below:
I would like to share my sample code on how to hide a custom field based on workflow status using scriptrunner cloud behavior with community as below:
const cField = getFieldById("customfield_XXXXX")
const statusField = getFieldById("status");
const statusFieldValue = statusField.getValue() ? statusField.getValue().name : null
if(statusFieldValue == "To Do"){
cField.setVisible(false)
}
else{
cField.setVisible(true)
}
Please let me know if it needs any further refinements or any other logics, we can use to achieve the requirement. It will be a great learning for me.
Thanks
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.