I am trying to set default description based on the issue type chosen, But the default value is in HTML. I have a very basic knowledge in scripting. Can anyone help me or provide me with some documentation which can sever my need would do a great help.
Behavior Script:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.*
Issue issue = issue
//def issue = issue as MutableIssue
if(issue.getIssueType.toString().equals("story")){
issue.setDescription("")}
{color:#654982}*Pull Requests & Branches*{color}
<Devs to copy a link to at least the main PR on GitHub for ease>
{color:#654982}*Contacts*{color}
<delete or add to below as appropriate>
||PO||UI Designer||Analytics||Optimisation||
|Col A1|Col A2| | |
{color:#654982}*User Stories*{color}
As a <user>,
I want to <action>
So I can <motivation>
{color:#654982}*Scope*{color}
||Item||In Scope||
|Countries|<UK/PL/HU/SK/TH/MY>|
|Viewports|<All/Desktop/Mobile/Tablet/Specific pixel range>|
|Devices|<All/Specific device>|
|Client-side JS|<JS only/non-JS only/JS & non-JS>|
|Mode|<Normal mode only/Amend mode only/Normal & Amend modes>|
|Logged in/out|<Whether or not exclusive to logged-in/out>|
<Any other relevant scope details>
{color:#654982}*Design*{color}
<Zeplin file URL>
<Clarifying notes>
*{color:#654982}Acceptance Criteria{color}*
||#||Given||When||Then||
|1.| | | |
|2.| | | |
{color:#654982}*Non-JS*{color}
<Add non-JS detail here>
{color:#654982}*Accessibility*{color}
<Add accessibility requirements for this ticket>
*{color:#654982}Analytics{color}*
<Provide analytics requirements as separate, numbered scenarios>
+Analytics Scenario X - <description>+
WHEN <I click on a thing>
THEN An analytics event should be fired
*{color:#654982}Testing notes{color}*
<Automation testing: None/details>
<Other notes for testers>
*Optimisation Team details*
||Experiment key|oopXXX|
||Variation keys|*Control:* XXX-X
*Variant B:* XXX-X|
||Variant details|*Control:* Current experience|
*Variant B:* <Description of Variant B>
||Test ACTIVATE locations & conditions|<Describe when and how ACTIVATE is called>|
||DEFAULT Audience Attributes|<Details>|
||TEST SPECIFIC Audience Attributes|<None/Details>|
||Optimizely identifier|<CustomerID/TrkID>|
||Optimisation Trello ticket|<Ticket URL>|
||Optimizely QA Project link|<Project URL>|""")
}
if(issue.issueType.name == "Defect"){
issue.setDescription("""{panel:title=Bug Overview|borderStyle=none|borderColor=#80CCFF|titleBGColor=#80DFFF|bgColor=#80DFFF}{panel}
|| Environment:| PPE |
|| Affect versions | 2.3.0 |
|| Country:| IGHS |
|| Viewport:| All viewports |
|| Devices/Browsers:| All devices/browsers |
|| Pages:| Slots page |
|| Steps to reproduce:| # Browse https://nakup.itesco.cz
# Register a new user
# Click on book a slot and choose collection
# Book a collection slot
# Enter collection instruction in the instruction box |
|| Expected: | Instruction should be saved upon typing and should appear in order summary page |
|| Actual: | Instruction is not getting saved and missing in order summary page |
|| Note: | Issue is intermittent with existing users but automation tests are consistently failing for new users (https://ci.ngbeta.net/job/Greenfields/job/grocery/job/master/362/). Also, issue is observed manually for both delivery/collection instructions |
|| Bug video/screenshot: | Video attached |""")}
Hi @Vimalraj
Below script was working for me try it out
Script:-
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
def StoryDefaultDescValue = """[Place your text here]"""
def DefectDefaultDescValue ="""[Place your text here]"""
def projectKey = getIssueContext().getProjectObject().getKey()
def issueTypeName = getIssueContext().getIssueType().getName()
if(issueTypeName == "Story"){
getFieldById("description").setFormValue(StoryDefaultDescValue)}
if(issueTypeName == "Defect"){
getFieldById("description").setFormValue(DefectDefaultDescValue)}
Hi Nikhil,
I use scriptrunner to set description in Behavior
def dg_sDefaultDescValue = """[Insert a concise description of the problem.]""".replaceAll(/ /, '');
getFieldById("description").setFormValue(dg_sDefaultDescValue);
Thanks,
Vimalraj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you @Vimalraj for the help
but now i am using this script but still facing the issue.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.Issue
def StoryDefaultDescValue = """
{color:#654982}*Pull Requests & Branches*{color}
<Devs to copy a link to at least the main PR on GitHub for ease>
{color:#654982}*Contacts*{color}
<delete or add to below as appropriate>
||PO||UI Designer||Analytics||Optimisation||
|Col A1|Col A2| | |
{color:#654982}*User Stories*{color}
As a <user>,
I want to <action>
So I can <motivation>
{color:#654982}*Scope*{color}
||Item||In Scope||
|Countries|<UK/PL/HU/SK/TH/MY>|
|Viewports|<All/Desktop/Mobile/Tablet/Specific pixel range>|
|Devices|<All/Specific device>|
|Client-side JS|<JS only/non-JS only/JS & non-JS>|
|Mode|<Normal mode only/Amend mode only/Normal & Amend modes>|
|Logged in/out|<Whether or not exclusive to logged-in/out>|
<Any other relevant scope details>
{color:#654982}*Design*{color}
<Zeplin file URL>
<Clarifying notes>
*{color:#654982}Acceptance Criteria{color}*
||#||Given||When||Then||
|1.| | | |
|2.| | | |
{color:#654982}*Non-JS*{color}
<Add non-JS detail here>
{color:#654982}*Accessibility*{color}
<Add accessibility requirements for this ticket>
*{color:#654982}Analytics{color}*
<Provide analytics requirements as separate, numbered scenarios>
+Analytics Scenario X - <description>+
WHEN <I click on a thing>
THEN An analytics event should be fired
*{color:#654982}Testing notes{color}*
<Automation testing: None/details>
<Other notes for testers>
*Optimisation Team details*
||Experiment key|oopXXX|
||Variation keys|*Control:* XXX-X
*Variant B:* XXX-X|
||Variant details|*Control:* Current experience|
*Variant B:* <Description of Variant B>
||Test ACTIVATE locations & conditions|<Describe when and how ACTIVATE is called>|
||DEFAULT Audience Attributes|<Details>|
||TEST SPECIFIC Audience Attributes|<None/Details>|
||Optimizely identifier|<CustomerID/TrkID>|
||Optimisation Trello ticket|<Ticket URL>|
||Optimizely QA Project link|<Project URL>|""".replaceAll(/ /, '');
def DefectDefaultDescValue ="""{panel:title=Bug Overview|borderStyle=none|borderColor=#80CCFF|titleBGColor=#80DFFF|bgColor=#80DFFF}{panel}
|| Environment:| PPE |
|| Affect versions | 2.3.0 |
|| Country:| IGHS |
|| Viewport:| All viewports |
|| Devices/Browsers:| All devices/browsers |
|| Pages:| Slots page |
|| Steps to reproduce:| # Browse https://nakup.itesco.cz
# Register a new user
# Click on book a slot and choose collection
# Book a collection slot
# Enter collection instruction in the instruction box |
|| Expected: | Instruction should be saved upon typing and should appear in order summary page |
|| Actual: | Instruction is not getting saved and missing in order summary page |
|| Note: | Issue is intermittent with existing users but automation tests are consistently failing for new users (https://ci.ngbeta.net/job/Greenfields/job/grocery/job/master/362/). Also, issue is observed manually for both delivery/collection instructions |
|| Bug video/screenshot: | Video attached |""".replaceAll(/ /, '');
//MutableIssue issue = issue
def issue = event.issue as issue
if(issue.issueType.name == "Story"){
getFieldById("description").setFormValue(StoryDefaultDescValue)}
if(issue.issueType.name == "Defect"){
getFieldById("description").setFormValue(DefectDefaultDescValue)}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.