Hello,
I'm using Run a Script action in Jira automation to clean a checkbox field (Deviniti [Dynamic Forms] - Dynamic Checkboxes). The code is (maybe excessive):
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.Issue
def field = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("Checkbox")
issue.setFieldValue(field, null)
def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Checkbox")
issue.setCustomFieldValue(customField, null)
Both issue.set.... show the similar error:
Static type checking - cannot find matching method com.atlassian.jira.issue.Issue#setCustomFieldValue or #setFieldValue
Please advise.
BR
Hi @Ivan D
Why a you using a script in automation for JIRA when you could use a rule that just edit the field ? If you edit a field but set no value it will clear it, no need to use a script.
Regarding the script
"setFieldValue" is use in Behaviours only
"getCustomFieldObjectByName" is deprecated
Regards
Hi Florian,
Thank you for the feedback.
I cannot use Edit issue action because it doesn't see the field (not available to choose)
I'd use Additional fields there but I cannot figure out how to create correct JSON expression (question here)
BR
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.