Jonny Carter Expert

Comments

  • I'm a bit confused. Linking the cloned issue with its original is exactly what the Clone Issue and Link post function already does. Am I misunderstanding which issues are A & B or something??
  • I understand that. The trouble for me is in reproducing the problem. Where are you _getting_ the AutoTask libs? The full stack trace would also help me help you.
  • Since you're working with Behaviours, there's a variable in the binding for the current request. It's an HttpServletRequest object. Inside your Behaviour's Groovy script, you could get the URL as a string using request.requestURL.toString() You could then parse that URL string and retrieve its query parameters using normal…
  • You're nearly there. The code you linked to shows pretty well how to deactivate a user, I think where you're struggling is how to get a user from query parameters. Something like this should do: import com.atlassian.crowd.embedded.api.CrowdService import com.atlassian.crowd.embedded.api.UserWithAttributes import…
  • Perhaps you could accomplish something similar with Jira's built-in Issue Filter subscriptions? https://confluence.atlassian.com/jira064/receiving-search-results-via-email-720416706.html Each user could just subscribe to a filter with JQL like duedate < now() and resolution = Unresolved and assignee = currentUser() If all…
  • So, I'm having some difficulty finding any information about the AutoTask Java API. I've found a Web Services API, a REST API, but no JavaDoc or anything. My hunch is that you would need to make sure that a library with the AutoTask API was available on the classpath. I've been unable to find such a library in any maven…
  • Just as a side note, I haven't quite determined if it's possible to set a custom field from the Insight plugin via Behaviours. I can tell that setting the form value to what looks like the object's unique ID (which seems to be what you're doing with field.setFormValue("AS-9573")) doesn't work. If you can answer Josh's…
  • Also a good point from Josh: Behaviours aren't yet compatible with JIRA Service Desk screens, which may be why you aren't seeing the changes reflected. If you're editing the issue on Jira's normal Create/Edit screens, they should work, though.
  • For a multi-user picker field, you should be able to set it to a list of strings, where the strings are the user keys for the users you want to add to it. For example, getFieldByName('MultiUserPickerA').setFormValue(["someuser", 'admin']) As to the Insight field, I'm trying to reproduce that now. Will update once I've got…
  • I someone ask me a similar question at Summit. Basically, JIRA Service Desk's Approvers field takes a list of ApplicationUser objects. To put the reporter in the Approvers field, you'd just need to put it in the list. Something like: import com.atlassian.jira.component.ComponentAccessor def customFieldManager =…
  • The particulars will depend on each API that you use, but ScriptRunner comes bundled with the HttpBuilder library, which makes making HTTP requests of external APIs pretty straightforward. Here's a pretty basic example that I used to contact a local jenkins instance. import groovyx.net.http.ContentType import…
  • Take a look at the documentation on Customising the UI using ScriptRunner at https://scriptrunner.adaptavist.com/latest/jira/CustomisingUI.html. Take special note of the documentation on wiring up a dialog, including the notes about using javascript to add complex interactions. To create a form that takes input, you'll…
  • So, I was able to hide a field using this behaviour just fine. A few thoughts: * Be aware that behaviours only function on the create/edit screen, and to a lesser extent things like workflow screens and similar views. Hiding fields from the View Issue page isn't really what they do. There is technically a beta feature to…
  • This is actually one of the biggest known issues with Behaviours--namely, that they don't function on the JIRA Service Desk customer portal. You can watch https://productsupport.adaptavist.com/browse/SRJIRA-728 for updates related to that. In the meantime, the only way to add this kind of functionality to the Service Desk…
  • Hey, Tomas. Can you perhaps provide an updated version of your code? It's a little hard to pick up from the thread exactly where the script is at this point. I suspect that the issue here is that the "in" condition you have will work on the custom field value, as in 'Integrations' in cfValues['Scrum Team']*.value But it…
  • No problem. So, if you're listening on an issue event, the changeItems should be injected automatically. You can get them manually from an IssueEvent object like this: event?.getChangeLog()?.getRelated("ChildChangeItem") You can also get them from an issue object using the ChangeHistoryManager, as detailed in the Total…
  • Hi, Gil! You can get the new and old values from the list of changeItems like so: def change = changeItems.find { it['field']=='fixVersions'}def newValue = change['newvalue']def oldValue = change['oldvalue'] That should work in the condition on a listener (like Send Custom Email). You can then use those values for whatever…
  • Yup! There's a documented example of hitting the GitHub api at https://scriptrunner.adaptavist.com/latest/jira/behaviours-conversions.html#_walkthrough_external_rest_service. The Github API returns JSON, but the HTTPBuilder library can parse XML into a nice navigable Groovy object just as well. Indeed, it should do that…
  • changeItems won't be defined in the Script Console; it's only defined in the context of Script Listeners, specifically in the condition field. Do you really get an error there? If so, what version of ScriptRunner are you on, and can you provide a screenshot? I'm not seeing that in my instance.
  • I'm curious what version of ScriptRunner you are on, and whether this happens when your script runs or just in the code editor. There were some issues in the past where the static type checker fails to resolve classes from the script roots, but those should be fixed in the latest version. Can you provide a screenshot of…
  • The UserManager should do. import com.atlassian.jira.component.ComponentAccessordef userManager = ComponentAccessor.userManagerdef user = userManager.getUserByName("someuser")//ORuser = userManager.getUserByKey("someuser1245") For a JIRA instance with one directory, the user name and user key will typically be the same. If…
  • FWIW, you're right that ScriptRunner can totally do this. It's pretty straightforward to execute a JQL query in your script, then assign a value derived from the results to a system or custom field. For example, let's say you just wanted a field that displayed the number of issues returned by a particular query: import…
  • If you're looking for a PDF export, you could probably use Confluence's built-in PDF exporter. $confluenceBaseURL/spaces/flyingpdf/pdfpageexport.action?pageId=$yourPageID You'd need to get the page ID, though, and it looks like you're working with the space / page title combination. So your script could do the work of…
  • I'm afraid I still don't quite understand. Do you mean you want this done as part of a workflow transition? If so, you probably want to use a workflow function, most likely a validator. Perhaps it would help if you described in detail the behaviour you want from JIRA?
  • So... Community apparently nuked my previous answer? Because this question got flagged as spam for no good reason??? Anyway, here's the script again. Create a select list with group names, then add a post function to the create transition that does this: import com.atlassian.jira.component.ComponentAccessorimport…
  • You can keep your select list in sync with your groups via a script like this one running as a listener or a service: import com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.issue.context.GlobalIssueContextdef customFieldManager = ComponentAccessor.customFieldManagerdef groupNameField =…
  • Unfortunately, Group Pickers can't be added to the screen of a Service Desk portal, so there's no easy way to present users with a list of groups to pick from. See (and comment/vote) https://jira.atlassian.com/browse/JSDSERVER-86. That said, as a work around, you could setup a single select list custom field that had a…
  • There are separate docs for the priority and resolution fields. https://scriptrunner.adaptavist.com/latest/jira/recipes/behaviours/restricting-priority-and-resolution.html
  • Looks like you're running into some issues centering around how the APIs around users changed. See https://scriptrunner.adaptavist.com/latest/jira/releases/UpgradingToJira7.html#_user_replaced_with_applicationuser I'd recommend either changing your helper methods to take/return an ApplicationUser object or just use 'def'.…
  • You may simply need to use the IssueService to update the issue in order to make sure that all the normal business logic events are getting fired properly. Make sure to put a good condition on your listener so that you don't end up in an infinite loop where the listener keeps triggering itself. Starting from your script,…