how to set costum field value nulled using behaviour

Hello ,

I need to set custom field value to NULL when i edit other custom field using add-on behaviour , 


1 answer

1 accepted

1 vote
Accepted answer

Hi Taher.

Your description of your issue is rather shallow, so I'm going to try my best with the little information that you provided.

If you have 2 fields, A, and B, and you want to reset A when B is changed. You need to set a behaviour on field B, and when it gets changed, you need to change the value of A to "empty" rather than null. Null could cause issues.

If A is a textField you could do this:

def A = customFieldManager.getCustomFieldObjectByName("A")   
issue.setCustomFieldValue(A, "")

I hope this helps.




thank you :)

 but i want to use it with behaviours add-on 

yes, that should work in the behaviours part of SR. 

Oh wait, aren't you using SR at all?


i have this error 

Sans titre33.png

Can you send the whole of your script? I might be able to help you better with more information taher. I want to help you mate but you keep sending very little info, and that doesn't really help.

If you are in behaviours you need to use something like this:


when component is changed i want to set the other custom field nulled

import com.onresolve.jira.groovy.user.FieldBehaviours import groovy.transform.BaseScript import static com.atlassian.jira.issue.IssueFieldConstants.* @BaseScript FieldBehaviours fieldBehaviours def ff = getFieldById(COMPONENTS) def values = ff.getValue() def URL = getFieldById("customfield_15008") def URLD =getFieldById("customfield_15009") def Request =getFieldById("customfield_15011") def URLField = getFieldById("customfield_15012") def TOBE = getFieldById("customfield_15013") def source = getFieldById("customfield_15014") def dest = getFieldById("customfield_15015") def port = getFieldById("customfield_15016") def InApp = getFieldById("customfield_15021") def ReqR = getFieldById("customfield_15022") def specy = getFieldById("customfield_15023") def res = getFieldById("customfield_15024") def SON = getFieldById("customfield_15027") def SOT = getFieldById("customfield_15028") def SOL = getFieldById("customfield_15029") def SPEP = getFieldById("customfield_15030") def IPSE = getFieldById("customfield_15031") def SERV = getFieldById("customfield_15032") def RIGHTS = getFieldById("customfield_15033") /*---------------------------------------- Declation variable -----------------------------------*/ SPEP.setHidden(true) IPSE.setHidden(true) SERV.setHidden(true) RIGHTS.setHidden(true) SOL.setHidden(true) SOT.setHidden(true) SON.setHidden(true) res.setHidden(true) specy.setHidden(true) ReqR.setHidden(true) source.setHidden(true) InApp.setHidden(true) dest.setHidden(true) port.setHidden(true) URLD.setHidden(true) URL.setHidden(true) Request.setHidden(true) URLField.setHidden(true) TOBE.setHidden(true) /*---------------------------------------- hide all -----------------------------------*/ if(values.toString().contains("NEW URL")){ URL.setHidden(false) URLD.setHidden(false) }else if (values.toString().contains("Publishing URL / OPENING PORT")){ Request.setHidden(false) }else if (values.toString().contains("INTERNAL APPLICATION ACCESS")){ InApp.setHidden(false) }else if (values.toString().contains("NETWORK SHARED")){ res.setHidden(false) }else if (values.toString().contains("NEW SOFTWARE")){ SON.setHidden(false) SOL.setHidden(false) SOT.setHidden(false) }else if (values.toString().contains("PHYSICAL ACCESS")){ }else if (values.toString().contains("SERVER ACCESS")){ SPEP.setHidden(false) IPSE.setHidden(false) SERV.setHidden(false) RIGHTS.setHidden(false) }

well you would do it as I told you.

You get the id of the field you want to set to empty, in your case that's SPEP I believe and you do this:


Tell me if this works.


hello daniel

thank you it work :D 

but i need another thnik i juste need how to chek if component is changed on edit screen and based to this  boolean value i will set the next status 

can you help me 

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,111 views 4 9
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you