Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Didn't get a value from a customfield in a behavior

Olivier MAZEN
Contributor
April 11, 2018

Hello there,

 

I am actually working on a specific need for my customer.

For a Projet = A, IssueType = Request and a specific CustomField toto = Iron, he want to display the CustomField EntranceDate in the resolution screen.

 

I decide to use a Behavior (threw Scriptrunner add-on) to develop this feature.

 

 

here is was i set:

i) I create a new behavior based on my customeField EntranceDate

ii) I set a mapping for my project A and issuetype = Request

iii) In my behavior setting i hide my customfield EntranceDate 

iv) In my server script:

I test my CustomField toto liek this

if value = iron EntranceDate is unhide.

 

Actually i face an issue that in my server side script, i never retrieve my Customfield toto value, in my log is always a null return.

 

Please find below the server side script i used

def cfEntranceDate = getFieldByName("EntranceDate")

def cftoto  = getFieldByName("toto ")
def totovalue = cftoto  .getValue()

if ("Iron".equals(totovalue .toString()))

{

//action to do

}

I never reach the "//action to do" section.

 

Do you have any idea where i am wrong?

i also try to retrieve my Customfield EntranceDate with the ID, but nothing change.

 

I am pretty sure this is something stupide but i didn't get it.

 

I hope being clear enought to get understood :)

 

regards,

 

Olivier

 

 

 

 

1 answer

0 votes
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 11, 2018

Add the field toto to your behavior and add your script to the filed.

Olivier MAZEN
Contributor
April 11, 2018

Hello Alexey,

thank for your answer.

 

 

i have 3 field in my behavior:

Resolution

Toto

EntranceDate

 

i have put the script on resolution field. My comprehension is when i do any change on resolution field, the script will be triggered.

 

Unfortunalty, thi is not working actually.

 

Olivier

Olivier MAZEN
Contributor
April 13, 2018

Hello,

 

i found the solution.

 

i juste have my field in my screen and set it hide.

Like this i get the value i need for my behavior.

 

Regards, 

 

Olivier

Suggest an answer

Log in or Sign up to answer