Hello, im trying to update filed to null value with listeners. Aftet update logs shows me nothing, no errors, but nothing is changed, field still not empty. What wrong with my script?
short description of script: if value 1 == error or customization; then value 2 = null, then value 3 = null and ect
type fields:
value 1 - (type: Deviniti [Dynamic Forms] - Dynamic Select)
value 2 3 and others ( types: Deviniti [Dynamic Forms] - Dynamic Select, multiple select list, text field)
Script:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.CustomFieldManager
def issueManager = ComponentAccessor.issueManager
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def issue = event.issue
def field_1 = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Тип запроса")
def field_2 = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Пояснение к ЭФ")
def newValue = issue.getCustomFieldValue(field_1)
if (newValue =="Ошибка"){
field_2.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(field_2), null), new DefaultIssueChangeHolder())
}else if (newValue =="Настройка"){
field_2.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(field_2), null), new DefaultIssueChangeHolder())
}
My suspicion is that you can't update Devinity Dynamic Form fields like that. This is okay for most regular custom fields.
With Dynamic form, what you actually want to use their own API: https://deviniti.com/support/addon/server/dynamic-forms/latest/bundled-fields-java-api/
I have no experience with that. I just found the reference page.
All right, thnk u! I'll rebuild script and back soon.
PS: few days ago devinity custom field was hidden by regular script. I think something wrong with current script, cause i cant change even regular textfields :(
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.