Comments
-
Indeed, scripted field seems to be the best solution here. As far as JQL search is concerned it should be fine as long as you pick the correct searcher in your field config. As for the code, it is as follows: import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.fields.CustomField import…
-
You can pretty much ignore this error. It'll work just fine as is. Thing is static type checking in Scriptrunner is not always accurate. However if you wanna get rid of this error simply change "List" to "Collection" in the code.
-
Hi Jorden, I might be able to help you here. Please advise when exactly do you want this to trigger?
-
Check out PermissionSchemeService interface. It has all the tools you need.
-
Hi Amy, You've almost nailed it. Here's the correct way: import com.atlassian.jira.issue.Issue Issue parent = issue.getParentObject() List<Issue> otherSubtasks = parent.getSubTaskObjects().findAll{it.getIssueType().getName().equals("Estimate")} return otherSubtasks.every{it.getStatus().getName().equals("Final")}
-
Then I suggest using a 3rd party log analyzer or you can write your own script which would run on schedule and check your logs for errors, and send you notifications.
-
If you know exactly what kind of exception is thrown when your script fails, you can use a try-catch closure in your code to send an email whenever this error occurs.
-
@Alvin You can ignore these errors. Scriptrunner's static type checking is not always accurate.
-
In any case, even if you have a problem importing MultiKeyMap class, you can always use a regular Map, and simply use a collection of strings as its key, like so: Map<List<String>, String> map = new HashMap<>() map.put(Arrays.asList("attribute1", "attribute2", "attribute3"), "component1")…
-
@Alvin I assume your idea is to be able to pull the required component by using ANY of the attributes, right? Problem with MultiKeyMap is that you have to provide a set of ALL attributes mapped to a value to get that value. Surely, it's possible to write a logic that would first search all attribute sets for the attribute…
-
I will definately take a look at your other question. In the meantime, please mark this solution as 'Accepted' if it resolved your issue. Cheers!
-
Hi Alvin, Assuming your approvers field is a multi user-picker type custom field and requestor is the user creating the issue, the code for a post function is as follows. Make sure to put in on your 'Create' transition. import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.fields.CustomField…
-
I would solve this by either: 1) Writing a separate post function which would copy attachments from the original issue or 2) Write a custom post function which would clone the issue with all required fields and attachments
-
Hi, Assuming your custom field is a user picker, here's how to set an assignee; import com.atlassian.jira.component.ComponentAccessor def cf = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("fieldName") def user = issue.getCustomFieldValue(cf) if(user){ issue.setAssignee(user) }
-
Hi Dave, Here's how you do it: import com.atlassian.jira.component.ComponentAccessor def developerCf = ComponentAccessor.getCustomFieldManager().getCustomFieldObject((Long)13407) def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser() boolean isValid = true if(currentUser ==…
-
@Swarna Radha Try this: import com.atlassian.jira.issue.CustomFieldManager import com.atlassian.jira.issue.fields.CustomField import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.IssueManager import com.atlassian.jira.event.type.EventDispatchOption log.setLevel(org.apache.log4j.Level.DEBUG)…
-
Hi Edward, The method you are calling to set the assignee (setAssigneeId) is expecting a user id as its parameter and you are giving it a username instead. I would suggest using the setAssignee method instead, like so: issue.setAssignee(valueofcustomfield) Also make sure that your post function (the one, that creates sub…
-
@David Using it in a scripted post function. You need an add-on for that (either Scriptrunner or JMWE).
-
Hi Daniel, I think something like this is possible. This is how i see it: 1) Create a group which will be dynamically populated with users that are supposed to have access to your issue. Let's call it 'security group' 2) Create issue security scheme and configure it to give access to your issue to all people…
-
You can pretty much ignore this error, the code should still work. Static type checking in Scriptrunner is not always accurate. Oh and looking at your screenshot, don't forget to change 11111 to an actual ID of your field.
-
Hi, Could you show your code?
-
That's easy. import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.fields.CustomField import com.atlassian.jira.security.roles.ProjectRoleManager import com.atlassian.jira.security.roles.ProjectRole import com.atlassian.jira.user.ApplicationUser ProjectRoleManager roleMgr =…
-
Hi Teju, Here's how you do it. I'm going to assume that your 'Testers' field type is a single user picker and its ID is 11111: import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.fields.CustomField import com.atlassian.jira.security.roles.ProjectRoleManager import…
-
You can pretty much ignore this error, it should still work. Static type checking in Scriptrunner is not always accurate.
-
Ok. Assuming that 11111, 22222 and 33333 are IDs of your 'Invoice type', 'Account Code' and 'Cost Center' fields respectively, the code for a scripted validator is as follows: import com.atlassian.jira.component.ComponentAccessor import com.opensymphony.workflow.InvalidInputException import…
-
Hi Gavin, I might be able to help, but first, please advise the types of your 'Invoice type', 'Account Code' and 'Cost Center' fields. I assume they are single select lists? Cheers.
-
There's a typo on line 10. Instead of: issue.getCustomFiledValue(cf).getValue().equals("value") it should be: issue.getCustomFieldValue(cf).getValue().equals("value") After that you can pretty much ignore other static type checking errors. It should work.
-
Ah, I see. Then the code should be as follows: import com.atlassian.jira.component.ComponentAccessor def userManager = ComponentAccessor.getUserManager() def watcherManager = ComponentAccessor.getWatcherManager() def cfManager = ComponentAccessor.getCustomFieldManager() def cf = cfManager.getCustomFieldObject((Long) 11111)…
-
For PowerScripts check out Live Fields settings. See if there are any scripts "attached" to your project, and then check what those scripts do if any. For Scriptrunner check out its Behaviours functionality (Administration > Add-ons > Behaviours)
-
Hi Neha, Are you using any 3rd party plugins that could manipulate your field behaviours on different screens through JavaScript, for example PowerScripts, Scriptrunner or JSincluder?