Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

Can I set a default value for SUMMARY field, on a per request type basis?

Edited

I would like to set a default SUMMARY value for certain request types.

I found info here, stating to insert this javascript into the field. The instructions are:

 

  1. Go to the respective Field Configuration of the project.
  2. Find for the Summary field.
  3. Click on Edit.
  4. Input the following JavaScript at the Description of the field:

<script type="text/javascript">
if (document.getElementById("summary").value == "") {
document.getElementById("summary").value = "<Default Value for Summary>\n";}
</script>

But I gather this will affect this field in all forms, etc. Is that correct?

I read elsewhere that I could add,

if (issue.get("issuetype").name == "Issue Type" {

But actually even without this additional code, the above JS doesn't have any affect on the new issue form (on the user portal). And on the Agent site of things, I shows the JS under the field, as its description.

Is there any way (without using paid plugins/add-ons to achieve this?

 

2 answers

Hi,

For the customer portal you can set a default value and hide it too.

Regarding your main enquiry, make sure the Enable HTML in field descriptions and list item values is on in your instance (at least for Server/DC) and then it will populate.

I would also suggest to add an && clause to your example

 

<script type="text/javascript">
if (document.getElementById("summary").value == "") && (issue.getAsString("issuetype").name == "Issue Type") {
document.getElementById("summary").value = "<default Value for Summary>\n";}
</script>

 

 

You may need to play a bit  with the code, sorry I'm pretty bad at coding

0 votes

Hello @inspirednz

Thank you for reaching out.

I see that you are currently subscribed to Jira Cloud. Is that correct? Or are you using Jira Server (self-hosted)?

I ask this question because the functions/customizations you found using Javascript are applicable to Jira Server, however, they can not be implemented in Jira Cloud because Javascript and HTML create an XSS vulnerability and, for that reason, they are not allowed in Jira Cloud. You can find more details in the following documentation:

Functional differences in Jira Cloud products 

That being said, the best way to set a default text for the summary field based in the request type selected in Jira Cloud would be by using Jira Automation. These would be the steps:

  1. Navigate to your Service desk project > Project settings > Project automation (Not automation)
  2. Create a new automation rule to set the summary field with a pre-determined text, using conditions to define the text based on the request type selected:
    Screen Shot 2020-07-30 at 17.12.56.png

Let us know if you have any questions.

@Petter Gonçalves I've tried your instructions for Jira Cloud and does doesn't seem to resolve what I was hoping to accomplish. When I go to create a new issue it still has a blank required field in the standard Create issue dialogue and clicking create without anything input into the summary results in the "You must specify a summary of the issue." so the Automation never runs.

My hope was to default this create issue Summary to "[Auto]" and if the user overrides it will use the new name otherwise my automation post create would replace the name with fields provided at the time of creation by the user to format a default summary. Ideally, for this type of issue I'm designing, 99% of the time I don't want the user to have to think about entering anything in the to required Summary field.

The automation 'When: Issue Created' seems to only trigger post creation dialogue. 

2021-01-18 09_11_14-Project automation - Jira.png
It is also unclear as your steps refer to "Project automation (Not automation)", I only see Automation under the Project settings. I do not see anything that might indicate a difference between Project Automation and Automation.
 2021-01-18 09_21_51-Project automation - Jira.png

Am I missing something or is there another way to achieve my goal?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Site Admin
TAGS

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