Comments
-
Behaviours only work with built in jira screens (Created, Edit and Transition screens). It doesn't work with Clone, Move or Third-party screens.
-
Not sure what else to tell you. Have you looked at your logs? Are there any errors? With the simplest of behavior: I see this on my screen (have to put the "Log work" field on the screen and check the box during the transition to view the default value):
-
If you look in the tags for this question is it includes scriptrunner and script-listener. So this means that you need the ScriptRunner for Jira Server add-on and this is configured within that application using a custom script listener. If you don't know what that means, I would suggest you start…
-
Try with this: def timeSpent = getFieldById("log-work-time-logged"); I used the chrome developer panel to see the id of the field in the edit screen
-
Yeah, that's because of my sloppy null protection on lastASsigneeChangeDt. The static type checking errors can't know for such what type that's going to be. Here is an equivalent example without static type checking errors: import com.atlassian.jira.component.ComponentAccessor import java.sql.Timestamp def im =…
-
Bit of a transcription error ... change "td it" in the else block to "td val"
-
Sorry my mistake... Try this tbody{ output.result.each{ res-> tr{ res.values().eachWithIndex{val, idx-> def colHeader= res.keySet()[idx] if(colHeader=='u_change_record.number'){ td { a(href:"https://test.service-now.com/cm?id=cm_stdnew&table=change_request&view=sp&number=$val",target:'_blank') { mkp.yield val } } } else {…
-
Here is a short script (console) to demonstrate how to get epoch millis value as a standard base for comparing created field from the changeHistory against current date/time import com.atlassian.jira.component.ComponentAccessor def im = ComponentAccessor.issueManager def hm = ComponentAccessor.changeHistoryManager def…
-
The potential danger your manually putting in the headers is that with JSON and the resulting map object, there is no guarantee of the order of the fields. Should that change for some reason in the API, you may get mis-allignment. You can get around that by also defining each td by calling a specific key. tbody{…
-
Hi Sofia Behaviours are only capable of interacting with fields currently visible on the screen being displayed. What you are looking for is a Script Listener. Listen for "Issue Updated" event, if the SW issue being updated had the assignee field changed and the issue is linked to your JSM project, then add the current SW…
-
Here is how I would rephrase your rule... does that seem correct? When * either field A or field B is changed If * both fields contain a value Then * trigger the transition Or is it important that both fields have just been changed either together via the edit screen or in short succession (perhaps within the last x…
-
Ok, I'll take a stab at this... I see no one is daring to answer. The short answer is no, there is no cross-talk possible between server-side behaviour script. The longer answer requires some explanation of what behaviour does. When you open a screen (create, edit, transition), there is a bunch of back and forth between…
-
For the style tag, I would do it like this: def xml = new MarkupBuilder(writer) xml.style{ mkp.yieldUnescaped """ .aui td {color:red} """ } xml.table(class:'aui'){ [...] } For in-line style or any other attribute, just give the tags a list of attributes in map form to the parens for the tag. The map can be right in the…
-
Correct, but maybe instead of in-line style, create a <style> block above your table and then use class names in your table. Especially if you need to apply certain styles for each row or cell.
-
The class is there is you inspect the html. But when calling just a rest api, the styles are not loaded. If you were to display this table in web-panel within an existing Jira environment (where all the styles and scripts are loaded) then the table will have the desired style.
-
The first JSON output is perfectly valid for machine parsing But if you want a pretty layout, you can output toPrettyString() return Response.ok( new JsonBuilder(rt).toPrettyString()).build();
-
First, it looks like you left some api credentials in your last comment. If they are real, you might want to obfuscate them. Second, I'm not sure what this section's purpose is: rt = output def json = new groovy.json.JsonBuilder() json rootKey: rt def jsonString = rt.toString() def jsonOutput = new…
-
I would recommend you become familiar with groovy's markup builder Here is something I quickly put together to in the Scriptrunner Console import groovy.json.JsonSlurper import groovy.xml.MarkupBuilder def jsonString ="""{"result": [{ "u_change_record.number":"CHG0010042", "u_change_record.state":"Draft",…
-
Looks like your getting some good help on HOW to get data from your sql connection. But since you've mentioned custom field, I'll touch on that a bit. Let's assume that all you care about is this new_buildnumber based on the reporter Small tangent, here is a better/safer way to pass your reporter to your sql query: import…
-
That is not my experience... What I normally see is that the script runs once when you open the screen (be that for create, edit or any transition) and the form is initialized with its starting value. FOr create that could be "null" or the default value for the context. For edit/transition, that would be with the value…
-
Happy to help. Glad you figured it out. :)
-
When the helpText doesn't change after you change the single-select, I suspect there is some error happening in the code. If you have access to your <jira-home>/log/atlassian-jira.log I suspect you will find some additional clues there. But given that you have unmapped options that I assume you want to default to showing…
-
I don't really have details about your scenario. But conceptually, you appear to have 2 different business uses for users that are currently stored in the multi-user picker field. So I am suggesting you separate that first user into its own field. If, for example, your user picker field is used to designate a team. And the…
-
I don't see anything inherently wrong there. You can add something like this to give you immediate clues: formFieldA.setHelpText("Detected value $formFieldA.value (${formFieldA.value.getClass()}) in $formFieldA.fieldId this maps to ${map[formFieldA.value]}") That might provide some clues. Maybe there is a slight spelling…
-
Make sure the spelling for B matches the first part in my example def map = [ 'A':['Monday', 'Wednesday'], 'AB':['Monday', 'Tuesday'] ] I took you literally and labeled the second option "AB". If your second label is B and not AB, then your map will look like this: def map = [ 'A':['Monday', 'Wednesday'], 'B':['Monday',…
-
Ah... sorry, I wasn't careful with the details. Add the following 3 lines a tthe top of the script: import com.atlassian.jira.component.ComponentAccessor def optionsManager = ComponentAccessor.optionsManager def customFieldManager = ComponentAccessor.customFieldManager
-
Hi There is no inherent sequence to the list of users associated with a Multi-User Picker. In fact, it is my observation that the list is always sorted alphabetically with every save operation. At the database level, there would be an incrementing unique id for each value instance. But with each save/update, the whole list…
-
I don't think this is possible to do. Fundamentally, the whole purpose of a listener is to perform some task at the server-level in an asynchronous fashion relative to the action that triggered the event in the first place. That action may or may not be associated with a user's action in the browser. There is no good way…
-
This is absolutely possible. I see some typos in your script. Try like this: def customA= getFieldById("customfield_16191") // regular select custom field def customB= getFieldById("customfield_14200") //radio button customA.setRequired(customB.value == "Yes") Make sure this script is installed on the customB field so that…
-
Generally, I'd recommend you just remove that "choose from the dropdown" option, remove your default value and set that field as required. This will let the built-in logic take care of ensuring a field is selected. But if you really insist on using a script runner script, you can do it with something like this: def field =…