Comments
-
If that section is commented out, and a user changes a random field on an issue, it will cause the rest of the script to run each time. Rather than just blindly commenting it out, I'd suggest we find out why it is blocking the script in your scenario. if(event.eventTypeId == EventType.ISSUE_UPDATED_ID) { def changeItems =…
-
Here is another version that should work better: import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.fields.CustomField import com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade import…
-
Ah yes, I can fix the issue with the issueCreated event. Also, let's put some more logging in the script: import com.atlassian.jira.bc.issue.search.SearchService import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.event.issue.IssueEvent import com.atlassian.jira.event.type.EventDispatchOption…
-
Here is another version of the script that might match your use case better... and it demonstrates the use of the issueService to update a single custom field. import com.atlassian.jira.bc.issue.search.SearchService import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.event.issue.IssueEvent…
-
I can't imagine why this script would work. It seems to combine elements from Jira and Confluence API. Here is a version that should work (provided you don't have too many users (otherwise it might either run very long or crash your instance with an out-of-memory or long GC). import…
-
Hello Marlee Welcome to the community. First off, I don't know why the documentation recommends using the classLoader to get riadalabs classes. In my experience, the following works just as well: import com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade def objectFacade =…
-
I am still not clear on what the trigger for this listener will be. Is it when the Request Number is added to ABC-1, you want to find all other issues with FixVersion = 1.1 and "Request Number" is empty and apply the same request number? to all issues that match the JQL? Or is it that every time a new issues is created…
-
cfValues['Test Phase'] will return an instance of "Option". You need to examine the "getValue()" method of the option to compare it against a string. cfValues['Test Environments'] will return an instance of a TreeSet of Labels. You need to account for the inherent multiple capabilities of that field. Then a label object…
-
Don't forget to add ".value" after cfValues['field name'] when the field is a single select.
-
Can you elaborate on your requirement by showing a concrete example?
-
Correct, if the custom field is a checkbox, you have to find the option and add the id (as a string). It is possible to have multiple. For example: import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.Issue import com.atlassian.jira.issue.context.IssueContext import…
-
This is a behaviour script. I can only work in a behaviour configuration like I described. Can you please include screenshots of your behaviour configuration? Also can you verify that the field names in the script are spelled 100% correctly? Are you finding any errors in the <jira-home>/log/atlassian-jira.log when you try…
-
Why are you using the REST api to create the issue? You're already in the java layer, why don't you create the issue using the Java api? import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.Issue import com.atlassian.jira.issue.link.IssueLinkTypeManager def issueService =…
-
I'm not sure what you are doing this with a script. You could just search for issues using the UI and export the list. But if you want to output the listOfIssues in a more friendly way, you can add return listOfIssues.collect{it.issueKey} //print one long comma separated list //or return…
-
I think you will have better and more performant results if you use the IssueSearchService with a JQL query. import com.atlassian.jira.bc.issue.search.SearchService import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.user.ApplicationUser import com.atlassian.jira.web.bean.PagerFilter…
-
You should be able to do this with the native Insight Automation. Create a new automation rule and in "When", select "Scheduled Event". Specify a CRON expression to execute daily or weekly or whenever. In the IQL Condition, add something like: objectType=Contract and "TerminationDate" < startOfDay() and Status != Inactive…
-
Using the scriptrunner script editor, create a file with a name like "totalProjectRatingCalculationBehaviour.groovy" Add the following to the file: import com.atlassian.jira.issue.customfields.option.Option import com.onresolve.jira.groovy.user.FieldBehaviours import groovy.transform.BaseScript @BaseScript FieldBehaviours…
-
In my experience, you can cause the updated class to be re-compiled by changing the console script. Even adding a space on a blank line suffices. If your script points to MyClassA, and MyClassA has a dependency to MyClassB. This will only work if MyClassA change. It won't if only MyClassB changes. In this case, you want to…
-
No, the best solution I found is the one I mentioned above. Just change the module key string after you update the file. Maybe you can examine the web traffic when you make such an update and then make a similar rest api call via your automation.
-
That sounds like the type of code I would have suggested. I don't know that I can easily find an example, but if you share more details of your scenario or even better your existing code, I can try to make a recommendation.
-
I don't know. I never tried.
-
Here is an example published by Atlassian: https://confluence.atlassian.com/insightapps/automation-1085180924.html
-
Correct, getRelevantConfig only gets the configuration context object. You need optionsManager.getOptions(csFieldConfig) to get the list of options.
-
I forgot to had, at the end of the entire script, return returnDate or just reuturnDate This will ensure that the final output of the script is the date you want.
-
I don't think that's possible with IQL You would need to store the actor in an attribute. It might be possible via groovy script, but you'd need to examine the history for the object. objectFacade.findObjectHistoryBean(objectId).first().getActorUserKey()
-
You need to add the current project to the context or create a separate context for the current project. Note that if the field has options, and you create a separate context, the options may not be the same. Also, what you are doing may not work all that well. Have you checked that after adding the fields, the screen…
-
My approach to something like that is to just evaluate the day of the week of the resulting date and if it's a saturday or sunday, I add 2 more days. Something like this: import com.atlassian.jira.component.ComponentAccessor import java.text.SimpleDateFormat import java.time.DayOfWeek def customFieldManager =…
-
Oops, I missed the "cloud" tag. My Suggestion may not work on cloud. My experience is mostly on server.
-
One thing I recently found out is that updating the second element in a cascading select field does not trigger any behaviour execution. So it will not be possible to populate the Details field when the second element is selected. You either have to define your default off of the first element only or rely on some other…
-
Granted, I'm not that experienced with Automation, but I don't think it has any form/input capabilities. Short of some other plugin, your choice for collecting user inputs are: 1) a jira screen with custom fields. Use a "Any Status to Itself" transition and link your screen as a means to trigger the action. All your…