Comments
-
Here is how I would rewrite that second script using many of the same concepts initially shared: import com.atlassian.jira.component.ComponentAccessor; def issueLinkManager = ComponentAccessor.getIssueLinkManager() def cfManager = ComponentAccessor.getCustomFieldManager() def excludedStatuses= ['Live', 'Withdrawn'] def…
-
Where are you using that code? You indicated console earlier. In console, you should have "def issue = ..." and have your test issue. Anywhere else, you should remove that line... the issue will be provied by the script context. Let's add some debug messages: import org.apache.log4j.Level import…
-
Apologies, I messed up when copying. import com.atlassian.jira.component.ComponentAccessor def issueLinkManager = ComponentAccessor.issueLinkManager def issue = ComponentAccessor.issueManager.getIssueObject('JSP-1922') //only for console, issue will be provided by the workflow/listener context def excludedStatuses=…
-
What type of data is SQL expecting lotTovara to be? Can you share what your equivalent console script looks like for setting that variable? In console, you won't typically have access to getFieldByName(), so I suspect you are setting lotTovara to something else. Then, in that case, you must find a way to convert to the…
-
Yeah, a post function that creates many clones can take a while. If the slowdown is not an actual server resource issue, one thing you can try, but requires creating the clone via custom script instead of built-in options, is to use the Threa.start construct: Thread.start{ //code to create your issues } This will start the…
-
There is a suggested approach for doing this on the scriptrunner documentation https://scriptrunner.adaptavist.com/5.0.3/jira/recipes/workflow/validators/validate-attachments-links-in-transition.html
-
I've been on a journey to make more of my scripts and responses "groovy" ... I think this 10-line script can achieve the same output import com.atlassian.jira.component.ComponentAccessor def excludedStatuses= ['Live', 'Withdrawn'] def includedLinkTypes = ['Depends'] // Get only outward links def links =…
-
This uses velocity template and I'm not super well versed in it ... but try this: #if ( $value < 5 ) <font color='red'>$value</font> #elseif ( $value > 5 ) <font color='green'>$value</font> #end
-
The example I included removes all watchers from all sub-tasks. You would need to implement additional logic if you just want to remove watchers from the recently created sub-tasks. Something like this for example: import com.atlassian.jira.component.ComponentAccessor def user =…
-
I meant to add a custom scriptrunner post function AFTER the bob-swift post function(s) that create the subtasks. This scriptrunner script will then remove those watchers form all the sub-tasks that will have just been created.
-
There are 3 very different types of relationships between issues that I can think of right now and I'm not clear which you mean since you are using terminology from all of them. * issue links: these are bi-directional. Either "inward" or "outward". Issues on both sides of the link are at the same level (not parent/child) *…
-
The output of your scripted field should match the data type expected by the searcher so that it can be indexed properly. If you want to have a different visual, then you can set a custom template: <font color='red'>$value</font>
-
Issue links do not store any information about when or in what order the links were created. They are displayed in the order specified by the jira.view.issue.links.sort.order property So if you want to know the latest issues that was linked. That's not possible from the Issue Link panel in the UI or from the…
-
Hi @Jordan Berry While this can all be done with scriptrunner, this is getting into add-on territory in terms of complexity. I know you said you have it working via workflows, but just in case your implementation is different or others come across this post, this is what I'd recommend: * For the "button" add a workflow…
-
I am not sure why you can't prevent watching from the Create transition. I tried and even if you make the script the very last step, the current user is still the watcher. So, short of disabling AutoWatch globally, you can add a scriptrunner script on the transition that creates the sub-tasks, and after that sub-task…
-
I think I was working on 8.3 at the time of my answer. I saw that with 8.5.1, you are correct, toLong() is required. I also found this works: results.getResults()*.document.collect{ ComponentAccessor.issueManager.getIssueObject(it.getValues('issue_id').first() as Long) } I can't think of why one would be better than the…
-
Hi @Alik The issue is that if the data isn't there, there is nothing to view. And underneath it all, if those actions don't generate a system event, then there is no option to create your own listener to log this information. The only option would be to completely re-write your own solution/UI to manage options and context…
-
I'd be happy to help further, but I don't see any attached file.
-
In my testing, I have not found a way to do that. You might be able to find more information in the platform documentation: https://developer.atlassian.com/server/jira/platform/issue-view-ui-locations/
-
Hi @Celeste D_Alessandro The little (i) below the script editor is often useful. In this case, you should see the "chageItems" is available. Then, you can look to see if any of the changeItems include the field you care about. changeItems.any{it.field == 'Reference RD'} That's all. I'm assuming your notification scheme is…
-
Hi @Stuart_Hart In the scriptrunner world, you will be looking at a custom post function, not behaviors/conditions. They have many built-in functions, but none that does exactly what you want. So you'll need to create it from scratch. Something like this may work for most cases: import…
-
Hi @Günter Halmans My first thought is to create a scripted field representation of just the issues key from your Issue Picker field (or issue summary or combination). But in my test environment, I can't seem to be able to group by any scriptrunner field (not the issue picket and not a test custom field). Perhaps we have a…
-
I do not think this is possible.
-
Hi @jordank I didn't know for sure ... and rather than just give you the answer .... let me share how I found out. First I look at the available methods in ChangeHistoryManager. I saw getChangeItemsWithFieldForIssues which returns a ChangeHistory. Looking at the list of methods for ChangeHistory, I saw changeItemBean which…
-
Hi @Johnson Wang This can be implemented with scriptrunner behavior. But there are a few questions to answer that might impact the complexity of the solution. * Do you ever want the users to be able to change one and not the other? What are the cases when this should be possible? * Should the same behavior take place when…
-
Hi @Jeff Tillett If you don't need to bother with the link directionally, you get just use the 'getAllIssues()' method from the linkCollection. Here is a snippet that works in the console: import com.atlassian.jira.component.ComponentAccessor def ilm = ComponentAccessor.issueLinkManager def im =…
-
I think you might be complicating things unnecessarily. In the clone post-function, the additional issue actions will have 2 variables available in the context: sourceIssue (the issue that triggered the workflow) and issue (the cloned issue created by the post function). In your example, sourceIssue will be ABC-47 and…
-
@Krishna , where are you using this code? "Job" is probably not a valid issue key. You need to have the full key for the current issue. Typically something like "JOB-123" Look in your script context (the (i) icon below the script editor field. This will show you what variables are already defined for you and issue may…
-
Hi @Graeme Johnson The sure is a way to check this and it's very easy: if( issue.issueType.subTask){ //do something for sub-task issue types } else { //do something for parent issue types }
-
Here is an example of a previously answered similar question: https://community.atlassian.com/t5/Adaptavist-questions/Scriptrunner-and-Issue-Security-Levels/qaq-p/732271