Forums

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

Error adding a component as a post function using Scriptrunner on Cloud

Jade Stephen September 2, 2020

We are using Jira Cloud with the most current version of Scriptrunner.

I am trying to add a component to a production support issue as a post function with scriptrunner on create. I have added the following script:

     issueInput.fields.components += [[ 
          name: "Support Issue"
     ]]

Im getting the following error:

 

2020-09-02 15:26:40.668 ERROR - No such property: issueInput for class: Script1 on line 1
2020-09-02 15:26:40.785 ERROR - Class: com.adaptavist.sr.cloud.workflow.RunScript, Config: [className:com.adaptavist.sr.cloud.workflow.RunScript, uuid:3b0cd080-f87b-4f3d-bdc6-682713f6bd31, description:Add Support Issue Component, enabled:true, condition:issueInput.fields.components += [[
name: "Support Issue"
]], executionUser:ADD_ON, accountId:5d28a2eb831d7b0bcfbe559a]

 
Any suggestions?
I'm really new to Scriptrunner and having a hard time, so any help is very appreciated.

1 answer

1 accepted

0 votes
Answer accepted
Ste Wright
Community Champion
September 5, 2020

Hi @Jade Stephen 

What is the outcome you're trying to achieve with the script?

Adding a component during creation might be possible to achieve without a script, using Automation. If you can provide the specific scenario, I'd be happy to try and find a solution :)

Ste

Jade Stephen September 8, 2020

Hi Stephen,

 

I am trying to automatically add a component to a support issue when its created for tracking purposes.

We have a board that will track these issues with an expectation that they will be moved to other projects during their life cycle.

Ste Wright
Community Champion
September 8, 2020

Hi @Jade Stephen 

It's possible to do with Automation if this helps?

For example, to add a project-level rule for this:

  1. Go to Project Settings > Automation
  2. Press the blue "Create Rule" button
  3. For Trigger, choose Issue Created
  4. Add a Condition, Issue Fields Condition - Issue type (field) equals (condition) Support (value)
  5. Add an Action, Edit Issue - choose the Components field, and set the required value
  6. Give the rule a name and activate it

^ This should provide the desired outcome.

See more information about Automation for Jira on these pages.

-------------

You can also create this as a global (multi-project) rule if you prefer. You'll need to be a Jira Admin, then access Automation via Jira Settings > System > Automation Rules.

Just remember that global rules have an execution limit per month - whilst project executions are virtually unlimited.

For premium, the execution limit is 1000 executions per licensed premium user, per month, across your whole instance (eg. 200 users = 200K executions).

Ste

Jade Stephen September 8, 2020

Thanks!

Like Ste Wright likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events