Comments
-
It would help if you could include the errors from the log. Also, I noticed this link on the Adaptavist documentation page. So perhaps converting your class to a simple script would fix your issues. Try this: import com.atlassian.jira.issue.index.IssueIndexingService import com.atlassian.jira.component.ComponentAccessor…
-
Also, the other signature of isUserInGroup(ApplicationUser, String groupName) as suggested by Wade will work.
-
Found and corrected a typo comment.authorApplicationUser was comment.authorApplicatioUser
-
Newer versions of scriptrunner include a static type checker. These errors just indicate that there "MIGHT" be errors in your code. But since groovy supports dynamic typing, this code should still run fine. If you want to remove all static type checking errors you will have to strongly type all your variables (in effect,…
-
Try if(fix_Issue.fixVersions?.name && changeItems.any {it.field=='Fix Version'} ) and looks like your second line is missing a carriage return it.setFixVersions(fixVersions) issueManager.updateIssue(event.getUser(), it, EventDispatchOption.ISSUE_UPDATED, false) Also, I don't see any re-indexing of your sub-tasks ... that…
-
For that, you will want to use GroupManager [...] def groupManager = ComponentAccessor.groupManager def group = groupManager.getGroup("name of your group") [...] if (comment.getRoleLevelId() == null && comment.getGroupLevel() == null) { if(groupManager.isUserInGroup(comment.authorApplicationUser, group)) { return…
-
I use event.issue.key event is an instance of IssueEvent event.issue returns an issue object And event.issue,key is a groovy shortcut for event.issue.getKey()
-
Where is this being run from? If it's run from a PostFunction, the change may be missing because of the order of the post functions. Be sure to place it before "update change history and story the issue". If this is in a listener or other script, then you need to perform several steps yourself if you want to replicate the…
-
The select list field has no values configured in jira. The list has to take the value only from the rest call. When using setFieldOptions the list field only shows This is not possible. Single Select field and Multiselect field store a relational "option" id in the database. So that option must exist for a given issue…
-
Oops, my bad. Made a small error when transferring and adapting my example code from my environment. Response above updated with def capacity = ComponentAccessor.customfieldManager.getCustomFieldObjectByName('Capacity') Bu what Tanya said is also true. This won't work if you try to report on this value since scripted field…
-
I like doing things the groovy way ... I think this should work: import com.atlassian.jira.component.ComponentAccessor def capacity = ComponentAccessor.customfieldManager.getCustomFieldObjectByName('Capacity') def totalSum = issue.subTaskObjects.sum{ it.getCustomFieldValue(capacity)?.toInteger() ?: 0 } ?: 0 totalSum The…
-
Restricted comment gets applied either a "RoleLevel" or a "GroupLevel" based on what type of restriction was applied. Looking at the API documentation for Comment, you can see that there is a "getRoleLevel" and "getGroupLevel" methods. So, when you get the comments for your issue, you can just filter out all the…
-
I tried your script as is (only changed the field names) and it worked (using Jira 7.13.2). So it may be down to the type of fields. But I do see something unnecessary: This: def tgtField = customFieldManager.getCustomFieldObjects(event.issue).find {it.name == "Risk Score"} Could be simplified (and use the same pattern as…
-
Hi Clair Keeping in mind that issues are not aware of date changes. This doesn't generate any workflow or issue event. So your solution will be based on some sort of scheduling mechanism. Your first option (no scriptrunner needed) is with a few saved…
-
This can also be done with the ScriptRunner add-on if you happen to have that available. Using the "Simple Scripted validator" (or condition if you prefer to not even show the transition button). /* The Issue must not have been in Status Draft at any point before its current Status */ import…
-
This is just a guess here ... but you should not have needed to create your sprint custom field. When you enable Jira Software, my guess is that all the agile fields would be created automatically. This is what it should look like:
-
I don't know if that would be any sort of best practice ... or if that's even possible with cloud, but on server, my first goto would be to store the token in a custom application property. //store a custom property ComponentAccessor.applicationProperties.setString("com.acme.myoauthtoken", "put your token here") //retreive…
-
I see no reason why this would not work as a validator. You may want to protect against zero values being selected. In this case, getCustomFieldValue will be null and size() then definitely won't work. But have you tried a simple scripted validator implementation so you can leverage the cfValues map Notice the ? before…
-
You could try something like this: def instanceFld = getFieldByName("Instance") def estimatedDateFld = getFieldByName("Estimated end date") instanceFld.clearError() estimatedDateFld.clearError() if(instanceFld.value instanceof ArrayList){ instanceFld.setError("Please select only one") return } if(estimatedDateFld.value){…
-
In my version of Jira, it was working even with Run Now. But glad you're able to see the logs with the scheduled run. at least.
-
I'm a big fan and use lots of custom emails using similar scripts. But I thought some readers could benefit from the clarification. Also, the boilerplate language can still be specified using the filter description (hidden with permission screen).
-
I've tried your exact example and it works. Keep in mind that all the additional issue action code is executed before the updates are performed. So the log line you are looking for could have scrolled past pretty quick. So in the case, the order of operations are: * set the summary in issueInputParameter (this is a…
-
I don't think this works:
-
A starting point would be: issuefunction in parentsOf("issuetype = 'Commitment' and resolution is empty") But this won't give you the "More than one" part of your requirement. This will include all Epics with one or more open subtasks. If that requirement is critical, you will need to create a scripted field to query on:…
-
I think the updateIssue method is the correct one, but I wonder if you have the correct arguments:…
-
Scriptrunner/behaviour can't GRANT permission if it's denied by the permission scheme. The users' can't even open the edit screen (or do inline edits). You would have to open up the permission in the permission scheme to allow Edit Issue for watchers, then use behavior to set ALL OTHER fields to read-only. This means of…
-
No sooner asked then answered .... I had actually been thinking for a few days about that, then realized that I could probably just throw an exception. And yup, sure enough, that works throw new Exception("Skipping this action")
-
I don't think you even need a script for that. Why not just use Filters and subscriptions? For example, create a filter for issues not updated in 2 weeks and save it. project = foobar AND Updated < -2w AND resolution is empty AND status != Backlog AND assignee = currentUser() ORDER BY status ASC Note the…
-
Scriptrunner scripts go in [JIRA-HOME]/scripts ... your screenshot shows the [JIRA-INSTALL] directory.
-
Doh... I searched for answers all afternoon ... and just as I hit submit, a thought occurred to me. I can just add a suffix to Module key in the Install Web Resource config. Like com.acme.fancywebresource.v1 then com.acme.fancywebresource.v2 etc This seems to cause the resources to be reloaded with a normal refresh. So…