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

ragadeepthi moturi September 23, 2013

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

0 votes
JamieA
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.
September 23, 2013

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.

ragadeepthi moturi September 23, 2013

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.

ragadeepthi moturi September 23, 2013

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

JamieA
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.
September 23, 2013

Do you see any log output at all?

ragadeepthi moturi September 23, 2013

no, am not able to see any log statement.

JamieA
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.
September 23, 2013

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?

ragadeepthi moturi September 23, 2013

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"/>
</field>
</config>

ragadeepthi moturi September 23, 2013

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 http://jira.atlassian.com/browse/JRA-20696
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

JamieA
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.
September 24, 2013

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

ragadeepthi moturi September 24, 2013

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>

*Impact*

<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: "

**************

JamieA
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.
September 24, 2013

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.

ragadeepthi moturi September 24, 2013

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*

*Impact*


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)

JamieA
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.
September 24, 2013

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.

ragadeepthi moturi September 25, 2013

Hi Jamie

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

*Observed Behaviour*

*Expected Behaviour*

*Impact*

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

Observation

Expectation

Reproduce steps

Additional information:

Added log files/flows etc.

JamieA
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.
September 25, 2013

I already suggested - use a regex.

ragadeepthi moturi September 29, 2013

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

JamieA
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.
September 29, 2013

underlyingIssue.statusObject.name

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

ragadeepthi moturi October 2, 2013

Thank u Jamie it is working with

underlyingIssue.statusObject.name for status

And also i tried with underlyingIssue.issueType.name 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
TAGS
AUG Leaders

Atlassian Community Events