PD Sheehan Expert

Comments

  • Script Listeners react to server-level events. Those are generally post-transaction events. Behavior Initializer scripts fire when a form opens (whether a new issue is being created or edited). Behavior Field scripts fire when the field it's associated with changes. So what you need is a behaviour linked to your…
  • You do understand that script listeners are server-based events right? This fires AFTER you submit the form to create the new issue and after the "create" transition in your workflow is executed. So to know whether the listener fired or not, you will need to create/save a new issue then review the listener logs/history. If…
  • The event variable will dynamically be interpreted in the in-line code box depending on the Events selected in the form. If you only have "Issue Created" in the form, the static type checking should identify it correctly. But if you have more than 1 event selected, all events must be the same type and contain the same…
  • I haven't tried it... But see if you get get the value of the custom field "Epic Link" from your new issue during the creation transition. This should be either an issue key (string) or an issue object. From there, compare the assignee for the issue in that field against the current user. If the field is empty, that means…
  • I use Intellij Community Edition. It has good free support for Java and Groovy. You can follow the adapatavist instructions for setting up a development environment. By using one of their sample projects, you can import all the dependencies. cfm.getCustomFieldObject only gets a custom field object. To get a value for a…
  • That's normal in an external IDE. "event" is a variable that will be injected by scriptrunner during runtime. If you use the scriptrunner in-line code editor, you will see that in there, event will not have any error. To know what variables will be injected into a script in any context, click on the question mark below the…
  • Script listeneres and behaviours are complete different beast and very listtle code can be shared between the two. Namely, behaviour comes with several built-in methods that won't exist in the script listener. You can find a partial list here. For script listeners, you will be dealing more directly with Jira API (like you…
  • The error you posted includes all the details you need to debug this yourself Could not update object attribute due to validation exception:ValidationInsightException: Validation errors were found: rlabs-insight-attribute-591:…
  • I think you want either if(issue.subTaskObjects.every{ it.status.statusCategory == StatusCategory.COMPLETE}) return null throw new InvalidInputException('All open subtasks need to be closed') Or if(issue.subTaskObjects.any{ it.status.statusCategory != StatusCategory.COMPLETE}){ throw new InvalidInputException('All open…
  • The getCustomFieldValue method of the issue object, when the custom field is of type cascading select will return a Map with 2 items [null:ParentOption, '1':ChildOption] Both the ParentOption and ChildOption will be of type Option. So if you want to check if a specific combination had been selected, you can do it like…
  • Something like this should work import com.atlassian.jira.issue.status.category.StatusCategory issue.subTaskObjects.every{ it.status.statusCategory == StatusCategory.COMPLETE}
  • Can you provide more details? In what context are you running this script? Is it in a custom scripted postfunction, scripted listener or something else? What type of field is your custom field "Applications / Services"? Is is a single select drop-down? A free text field? An asset field? Something else?
  • If the last script is working, but the first 2 were not is because the reporter field was not available on the screen so it didn't return a real value. Glad that last script worked.
  • Ah... looks like "Work Item Type" is the "Jira work management" version of "Issue Type". I've never seen a jira environment with only Jira Work management. I've only seen Jira Software and Jira Services Management. My guess would be that in the code, it's still called "issuetype". You can use the IssueFieldConstants class…
  • If you hover over the "getCustomFieldObjectByName" or approvers, you might see something about it being a list or collection. And if you look at the name of that method, you will see that it is plural. These two things together mean "approvers" is actually a list of custom fields. And you can set a value on intended for a…
  • There are many ways to achieve that. One way is to use the existing construct and just expand it: import com.atlassian.jira.issue.IssueFieldConstants import com.onresolve.jira.groovy.user.FieldBehaviours import groovy.transform.BaseScript @BaseScript FieldBehaviours fieldBehaviours def userFormField =…
  • The groovy language used throughout Scriptrunner is a Java-based language. As such, I would highly advise you to adhere to industry-standard java conventions. There are many places you can you look that up, but here is an example: https://www.javatpoint.com/java-naming-conventions Also, groovy doesn't require any…
  • Getting name-dropped in a blog! Am I a celebrity now? You might appreciate simplifying this even more by encapsulating what you call the "framework" in a simple class. Then you can just call it like this: import jiraserver.scriptrunner.utils.SRRestUtil def srRestUtil = new SRRestUtil() srRestUtil.makeRequest('GET',…
  • When you enabled fragment locator, scriptrunner generates a bunch of fragments for all the various locations where new web-items could be insrted. So what you've attempted to hide is one of those dynamically generated fragment. Web-items can't be identified with the fragment locator. Only sections and panels. What you want…
  • You seem to be talking about browser-side events like what might exist in a javascript layer. And Jira/Atlassian doesn't really offer a good way to tie into those. But you posted your question in the Adaptavist group with the adaptavist-server tag, so would it be safe to assume you have Scriptrunner at your disposal? If…
  • Just imagine if you were applying that IQL directly to the object advanced search and you wanted to select mulitiple Assume ${Organisation} resolves to "KEY-1, KEY-2" The IQL: Organisation = "KEY-1, KEY-2" would not work. So you just change your iql to something that can accept multiple values: Organisation in…
  • Goovy is a server-side language while jQuery is a client-side language. The way behaviour works is 1) A client-side request is made to the server asking if any of the fields on the currently visible form are subject to any behaviour. The request sends the list of fields and their current values. You can examine the Network…
  • Are you talking in the context of selecting values in a custom fields? Or just applying IQL filters in the attribute configuration for Team? Either way, can you share the IQL you've used? If I understand correctly, you're saying that the Org attribute can accept mulitiple objects selection. And when you select more than…
  • I do not believe that it is possible from a behaviour initialiser script to detect if the screen was opened by clicking the edit button or attempting to open an in-line edit. I would view this as a feature request (or bug) for Adaptavist to have whatever logic automatically puts the focus on the field that the user clicked…
  • The defines the fields that must match between your import data and the existing objects to identify if a new object should be created or an existing one updated. If you have an attribute that is unique, then that's usually the best option. But in some cases, you might need to match on multiple attributes.
  • It would seem that you were able to resolve the issue and get the notifications you expect. I would appreciate it if you could mark this thread as the accepted answer. Thanks
  • I'm not sure what their purpose was. I never used them. But that feature was removed from Scriptrunner some time back (before v6.0): https://docs.adaptavist.com/sr4js/latest/release-notes/breaking-changes#id-.BreakingChangesv8.0.0-HiddenFieldsRemoval
  • The behavior getValue() method on Insight Custom fields, will return the Object's Key (as String), not the label or name of the object. Also, it might return a single string or an array of strings depending on a few factors. * Whether you are in a regular jira screen or portal screen * Whether the field allows a single…
  • I don't think behaviour is able to change the text of the "None" option on Single Select fields. There is a "setFieldOptions()" method that can adjust the list of available options, but it doesn't include the none/empty option. That seems to be automatically generated or added by Jira.
  • The starting point for using groovy with Insight is the Assets app development > Groovy scripting page And how each Insight/Asset classes might be used can be found in the JavaDocs For example, here is the JavaDoc for ObjectFacade and the Javadoc for ComentBean.