Comments
-
I think if you can use a post function, that's probably more specific than a listener. But you are correct, the built-in create sub-task feature can't be used as-is. You need to script the sub-task creation from scratch map.each{key, value -> //code to create subtask } You can borrow code for creating subtasks from the…
-
Can you provide a bit more context around this operation? Are your user objects populated automatically with some import? Or are you looking to create user objects manually by providing the username in the user.name attribute and have the "user jira" attribute automatically populated after saving so that object creators…
-
While I can see Ravi's point, I'm not sure I completely agree. I think having a confluence page as an easy place for users to maintain a list of values is a good approach in my opinion. There are some limitations and possible complications to be aware of, but it's definitely better than hardcoding the key-value mapping and…
-
Assuming the fields is not flagged as required (all fields must be set to optional) in the project's field configuration a script like this should work: def busDriverFld = getFieldByName('Business Driver') def tabFieldNames = ['ID Impact', 'Product Impact', 'PD Houses'] def requiredBySelection = busDriverFld.value !=…
-
This is absolutely possible, but you have to put it early in the post functions (before "Creates the issue originally"). Try it this way instead: package com.onresolve.jira.groovy.test.scriptfields.scripts import com.atlassian.jira.component.ComponentAccessor import org.apache.log4j.Logger import org.apache.log4j.Level…
-
There are no single fields (built-in or provided by any major plugins I know) that support this sort of data structure. You could implement this in a couple of ways with Scriptrunner. * With 2 multi-select custom fields (Departments/Teams) and a scriptrunner beaviour script .* The team CF would include all teams. * The…
-
Try comment out all but one of your "load object attributes" line then test them all one by one. I suspect that either one of the attribute id is incorrect, or (most likely), the object key you entered doesn't have a value for one of those attributes. When the object has an empty attribute, the "loadObjectAttributeBean"…
-
I have implemented a similar move (between two child object types with the same parent) and didn't need to use the "storeObjectBean" method. So I wonder if that's what tripping your script. The moveObjects method kicks off an asynchronous process so in your case, perhaps the storeObjectBean method is attempting to save the…
-
A tab cannot be made required or not required. You can only hide/show a tab. You will have to make all the fields in the tab required or not one by one.
-
Check for typos and correct case (groovy is case sensitive. I found 3 errors: * There are 3 s in Accessor* def issueService = ComponentAccesssor.issueService * The correct property for project in issueInputParamter is projectId not projectID * You labeled you variable issueInputParamters, but then tried to pass…
-
Behaviours on a specific field are executed whenever that field is modified. So you'll want this behaviour code on the Severity field so it fires when you change the severity.
-
Here is what I meant with that first lines... just to use some debug information This gives me some information about what type of data we get from fld.value. Then when I convert the script I gave you to work with my situation and fieldnames, I'm able to show/hide my sprint field accordingly Shown because I selected…
-
What I like to do in this case is do something like this: severity.setHelpText("$severity.value (${severity.value.getClass()}) This way, you'll see what you're working with based on what you select in your severity. I think you'll see an ArrayList of String values. Then, you can simplify your code quite a bit. Try this:…
-
There are some references in the scriptrunner documentation pages and the Adaptavist library for that: * https://docs.adaptavist.com/sr4js/latest/features/script-fields/script-fields-in-jira-service-management * https://library.adaptavist.com/entity/get-the-visibility-of-new-comments-in-jira-service-desk In short, you need…
-
Let me see if I understand ... you wish to copy the text from a custom field and append it to the description of each issues in a project? Something like this may work for you import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.web.bean.PagerFilter import…
-
Here is the Javascript I use to bind buttons in scriptrunner dialog: (function ($) { $(function () { var dialog = AJS.dialog2("#sr-dialog"); dialog.on("show", function (e) { $(e.target).find("#sr-dialog-submit").click(function (e) { e.preventDefault(); doSubmit(); }); $(e.target).find("#sr-dialog-close").click(function (e)…
-
If your "Type" custom field is a select of some kind, you might want to try it like this: def typeValue = (cfValues['Type'].value (typeValue != 'Software') || (typeValue == 'Software' && cfValues['Test Criteria']) That's because the cfValues data type will depend on the selected field. If it returns an "Option" object,…
-
After accessing an issue from a search results, I prefer to grab a new copy of the issue. The issue object in the results is not complete and not suitable for all typical operations: Try: thisissue = issueManager.getIssueObject(it.id) But then, I'm not clear how you expect to get a "status.status.name" from a custom…
-
I think this is the most relevant documentation that covers the any method: https://groovy-lang.org/groovy-dev-kit.html#_manipulating_lists But you are correct, this stops the loop as soon a "truthy" element terminates the closure. each or collect may be more appropriate in this case.
-
This is all really helpful. Thanks Maybe I have something weird in my project (it's a sample from a training)... but I have these two files: * mysampleplugin/src/main/groovy/com/mycompany/mythings/test1.groovy * mysampleplugin/src/main/resources/com/mycompany/mythings/test2.groovy After packaging, I have these two paths *…
-
Thank @Matthew Clark I was curious and tried to figure this out myself for the OP when it first appeared and wasn't able to. Out of additional curiosity, I re-installed the test plugin I had created then and found that I was able to access a script in mysampleplugin/src/main/groovy/com/mythings/myscript.groovy by adding…
-
@gnanavelu_murthy I only have experience with calling groovy scripts from adaptavist scriptrunner and only on server/dc instance. I've never used jira cloud and don't know of any ways to trigger groovy scripts without adaptavist scriptrunner.
-
The issue you're working with is just an object in memory. You have to use either the issueManger or the issueService to persist the change to the database I see you've instantiated the issueService and issueInputParameters but haven't used them. Instead of using issue.setComponent, try to use the issueInputParameters:…
-
You can try something like this (untested): import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.sharing.SharePermissionImpl import com.atlassian.jira.sharing.type.ShareType.Name import com.atlassian.jira.sharing.SharedEntity.SharePermissions import com.atlassian.jira.sharing.rights.ShareRights…
-
It might be caused by enabledCache={->false} In the documentation (https://docs.adaptavist.com/sr4js/latest/features/script-fields) there is this warning: If your script relies on data from external system you can invalidate the cache altogether, although you should test first, particularly if you are doing things like…
-
You can't do this to all dashboard at once, but you can loop through all dashboards and do it one at a time This uses the search method which is paged by default to prevent strain on the system. My example below only returns 100 pages starting at page 0 with an empty search parameter. You could do this multiple times, 100…
-
Not quite ... fieldId here would be the same so countyField and fipsField would point to the same thing. You need to adjust the data structure and flow def stateFieldMap = [ 'CA': ['customfield_18914', 'add fipsField Here'], 'AL': ['customfield_18910', 'add fipsField Here'], 'AK': ['customfield_18911', 'add fipsField…
-
The main issue is that you are attempting to compare the FormField object (State) with a string value. When you need to compare the value of the Form Field against your string Maybe it's just a style thing, but I like to abstract repetitive elements like you are showing into a simple data structure and make the actual…
-
Try using "parentObject" instead of parent. def originalDueDate = issue.parentObject.getCustomFieldValue(originalDueDateCf )
-
@Tuncay Senturk _Snapbytes_ I think he's asking about REST API. And by definition, the service desk rest API will not include any internal comments. While the jira internal api will include ALL comments. Hence my suggestion to look directly into the comment property. I guess the other option is to get ALL core comments…