It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

not able to avaluate the script to create custom text field in description field using behaviour plugin?

I added behaviour(0.5.6) plugin in jira ?

added one behaviour to that plugin.

added one field using fallowing script


log.debug "Debuggering..."
FormField descField = getFieldById("description")
log.debug "added text field..."
descField.setFormValue("Observation") // insert text value
log.debug "end of Field:


Added "Validate Jira Requiredness" as enabled, "Use Validator Plugin " as enabled and

Required (Optional)
Writable (Readonly)
Shown (Hide)

i used these properties while creating the behaviour but am not able to see the logs in console atleast first statement also. Script is also not working to create custom field.

Is this correct process am fallowing?If not suggest me the correct process.

1 answer

Have you mapped the behaviour to a project, and are you testing with that project? If not an orange warning method should be shown on the behaviour.

Have you set the logging level to debug by click the link on the page that lists all behaviours? If you are not sure change log.debug to log.warn.

Yes i mapped behaviour to a project , am testing with that project only. And i set logging as enabled, i tested with log.warn also then also am not able to create the template.

give me other any ways to create custom text field in description field. and to execute the script in behaviour plugin.

Do you see any log output at all?

no, am not able to see any log statement.

Is it definitely the system description field? If you go to the behaviours page, you can click edit, and you should see it as XML. Can you paste that?

It is the description field where we can give our description about the issue, while creating the Bug in jira.

<config use-validator-plugin="true" validate-jira-requiredness="true" name="raga" description="raga" guideWorkflow="null">
<field id="versions" required="true" readonly="null" hidden="false" validator="server" validator-class="" validator-script="log.debug &quot;Debuggering...&quot;&#13;&#10;FormField descField = getFieldById(&quot;description&quot;)&#13;&#10;log.debug &quot;added text field...&quot;&#13;&#10;descField.setFormValue(&quot;Observation&quot;) // insert text value&#13;&#10;log.debug &quot;end of Field: &quot;" validator-method="">
<when user="admin"/>

now when am trying to map the behaviour with project by clicking on map the behaviours to projects which is there in edit behaviour place am getting error in chrome(29.0.1547.66 m), firefox

XSRF Security Token Missing

Your browser has not provided any parameters at all and your input has been lost. Press back now to try and resend the data. This is most likely caused by a bug in the browser. FireFox 3.6.0 have been known to exhibit this behavior.
For more information see this bug report
JIRA could not complete this action due to a missing form token.
You may have cleared your browser cookies, which could have resulted in the expiry of your current form token. A new form token has been reissued.
Request URL: /jira/secure/admin/Behaviours.jspa

This behaviour is on the affected versions field - seems like it should be on the description field.

Thank u very much Jamie Echlin, by changing the field as description for my behaviour am able to add template in description filed.

*Observed Behaviour*

<describe what happened>

*Expected Behaviour*

<describe what should have happened>


<what impact will this defect have?>

But when am going to enter any text in description field , the text getting clear when i came out from description field. Only am able to see template structure after came out from this field.

i added my script like this :


log.debug "Debuggering..."

FormField descField = getFieldById("description")

log.debug "added text field..."

descField.setFormValue("*Observed Behaviour*\r<describe what happened>\r\r*Expected Behaviour*\r<describe what should have happened>\r\r*Impact*\r<what impact will this defect have?>")

log.debug "end of Field: "


Just check the description is empty before you set it, if not don't set it.

Also can you vote up some of my comments and answers, if they have helped you.

yes definatly ur comments are helped for me. can u please tell me how can i validate my template space between two fileds like Observed Behaviour , Expected Behaviour.

*Observed Behaviour*

*Expected Behaviour*


If the space between these two fields is empty i have to show an error msg.

I tried with the fallowing script but it is not working.

if (descField.getValue() == "") {

descField.setFormValue("*Observed Behaviour*:\r\r*Expected Behaviour*:\r\rReproduce steps:\r\rAdditional information:\r\rAdded log files/flows etc.:")

String priority = (String) descField.getFormValue()

log.debug "added text field..."+priority

if(priority.subString(priority.indexof("*Observed Behaviour*"), priority.indexof("*Expected Behaviour*")) == ""){

descField.setHelpText("<div class=\"warningBox\">please fill the template which is used for bug description.</div>")


and tried with removing the (*) also

but it is giving

groovy.lang.MissingMethodException: No signature of method: java.lang.String.indexof() is applicable for argument types: (java.lang.String)

You have to click the "like" button to show your appreciation!

indexof should be indexOf.

But I recommend using a regexp - there are plenty tutorials for groovy and regexes out there.

Hi Jamie

can u please suggest me about my problem in removing space between two fields

*Observed Behaviour*

*Expected Behaviour*


To remove the space between these templates i tried

FormField descField = getFieldById("description")

log.debug "added text field..."

//check status

if (descField.getValue() == "") {

descField.setFormValue("Observation\r\rExpectation\r\rReproduce steps\r\rAdditional information:\r\r

Added log files/flows etc.:")


if (descField.getValue() != "") {

String priority = (String) descField.getFormValue()

log.debug "sssssssssssssssssssss "+priority

priority.replaceAll("[\r\r]", "")

priority.replaceAll("\\s+", "")

but am not able to remove space between two fields

priority string is giving string like



Reproduce steps

Additional information:

Added log files/flows etc.

I already suggested - use a regex.

Hi Jamie

How can i get the status of jira like open, close, inprogress

i tried with the fallowing code

FormField statusField = getFieldById("Status")

log.debug "Status..."+((String)statusField.getFormValue())

It is giving null

I need to check for open status issue

my issue in jira is in open status but am not able to get the status field as Open

If the behaviour is in a transition you can use getDestinationStepName(), or getDestinationStep().

Thank u Jamie it is working with for status

And also i tried with it is giving always Bug for my jira if it is task also.

why it is giving always as bug. please suggest me about this.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Marketplace Apps & Integrations

Expose your beautifully crafted Dashboard through the Jira Service Desk Customer Portal

  A picture is worth a thousand words, especially when you're trying to find relationships and understand your data. Here, Dashboards play a vital role in gaining insights from a variety of dat...

331 views 5 4
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you