Comments
-
Hi Swapnil, I created the following script to be used in a scripted field. It gets all of the links from the Story and checks to see if the are of type "Sub-story". If there are "Sub-story" linked issues, it will get the custom field value from "Technical Points" on each issue. It will return the sum of all of the…
-
Hi David, Your setup looks correct. I think you are very close to getting this to work. One problem I noticed is that your script doesn't define the customFieldManager. Add this to the top of the script: import com.atlassian.jira.component.ComponentAccessor def customFieldManager = ComponentAccessor.getCustomFieldManager()…
-
Hi Arama, Are you using this behaviour with a JIRA Service Desk project? Or is this being used on JIRA server? Also, what type of field is "Flagged"? Is it a text field, checkbox field, select list, etc...?
-
Could you describe more what you are trying to accomplish? What is your use-case? Are you using ScriptRunner for JIRA Server or JIRA Cloud? Are you using a post-function to send a custom email?
-
Hi Swapnil, I understand your use-case and I think I have a script that almost accomplishes this, but could you clarify? Do you want the sum of ALL issues in the project that have an issue type of "Sub-story", regardless if they are connected to the same Story? * Example: Calculate the sum of 'Technical Points' of all…
-
Arama, Your code above looks almost correct, but it should not be in an initiailizer. Initializers are generally used for setting default values for fields, not for monitoring the value of a field. Put this code in a server-side script attached to the "Flagged" field. import com.onresolve.jira.groovy.user.FormField…
-
Behaviours do not work well with JIRA Service Desk, unfortunately.They are not compatible with each other. https://productsupport.adaptavist.com/browse/SRJIRA-728
-
Hi Michael, Which SR version are you on? Firing a custom event from a listener is already a built in feature. Go the Script Listeners page and click "Fire an event when condition is true." You can configure when you want to fire the event and which event to fire. If you need to create a new custom event, you should see…
-
Hi Stefani, You should be able to do this fairly easily using a behaviour. * Create a new behaviour added to Custom Field A * Add a server side script * Use this code (remember to put in the names of your fields for Field B and Field C) def SelectListA = getFieldById(getFieldChanged()) // Field A def TextFieldA =…
-
You should be able to do this fairly easily. You could set up a script listener that responds to "Issue Updated" events. In the condition of that script listener, check to see if the custom field value is "Red_Flag": import com.atlassian.jira.component.ComponentAccessor // get the Custom Field Manager def…
-
A script like this placed within a post-function will delete all of the names in the Request Participants field and just set it to an empty list. import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.ModifiedValue import com.atlassian.jira.issue.util.DefaultIssueChangeHolder def…
-
See other comment
-
Hi David, There are two things I'd look at. First, did you place that code in the "Additional issue actions box"? It should go in the Additional issue actions box, not the Condition box. Secondly, did you put the post function in the correct order? Your post function should be the very last thing, like this: Finally,…
-
I think this question is fairly similar to yours: https://community.atlassian.com/t5/Product-Apps-questions/Trigger-a-script-runner-script-on-sprint-events/qaq-p/341075 The only difference is that you don't want to transition any issues, so you wouldn't need that part of the code. You would just want to either fire an…
-
I think this page in our documentation is exactly what you are looking for: https://scriptrunner.adaptavist.com/latest/jira/recipes/workflow/postfunctions/set-issue-attributes.html Essentially, you can set non-custom fields like this in post-functions: // system fields issue.setDescription("A generated description")…
-
I believe this is already possible. It's just not implemented into the UI and involves some simple code. The paragraph underneath the Condition and Configuration block states the following: You can pass additional variables to the body and subject template using the config map, and dynamically control recipients using the…
-
Hi Darren, Using getValue() on a cascading select list field returns an array. To the value of either the parent or child option of a cascading select list, you'll just need to access the right index. def cascadingSelect = getFieldById(getFieldChanged()) def cascadingArray = cascadingSelect.getValue() log.debug("The values…
-
Behaviours do work dynamically on the Create screen (and other screens in general). For example: * A user attempts to create an issue * They choose a Select List Value of "New" * A text field is automatically hidden based on that selection, without the need to submit the form This is an example script of that: def reqValF=…
-
I think I slightly misread your question. I just realized you wanted the value of the "End Date" field on the Epic. The name of this scripted field will be "End Date Initiative". So we should change the script to get the value of "End Date": import com.atlassian.jira.component.ComponentAccessor if (issue.issueType.name ==…
-
You can do this, but from my testing, you need to count backwards. For instance, if I want all issues that have a fix version release date on Thursday, I'd write: fixVersion in releaseDate("on endOfWeek(-2d)") If I want all issues that are going to be released on Tuesday: fixVersion in releaseDate("on endOfWeek(-4d)")
-
Could you post the script you're using? Did you change what gave you? It looks like you're trying to get the reporter of the issue to use for the customer variable.
-
Hi Anthony, The static type checker for ScriptRunner can be wrong. Sometimes, it will tell you a matching method cannot be found even if it does exist. I think that's happening here. Try to just ignore the errors, save the script field, and go visit an Epic issue to see if anything is being displayed for the field.
-
This is the script I came up with for a scripted field: * If the issue type is "Epic", begin calculations (we only want this field to show up at the Epic level) * Access the parent link of the Epic * Get the value of the parent link * From the value of the parent link, get the key of the parent * Get the parent issue from…
-
Hi Christina, Yes, putting the script in the server side script seciton is fine. I have tested Jenna's code and it does work. However, I think you may just have the behaviour on the wrong field. The behaviour should be on the Select List (reqValF). The behaviour should not be on the text field that you want to hide.
-
Hi Andrew, For example: * Select List has values A, B, C * A is the correct value. * If the user clicks "Edit" and changes the custom field and chooses B or C, the comment field will be required. * The user will not be able to click "Update" until they provide a comment. def customField =…
-
Yes, you're correct that listeners wouldn't be very useful in that case. However, your question seemed focus on getting the specific value before and after the field was changed. I don't see why that would be needed if all you want to do is make the comment field mandatory based on a custom field value. You'd just need a…
-
You could do with this in a script field. I wrote the following script that will: * Get the value from a Date Picker field ("Meeting Date") * Format that value to be "month/day/year 8:30:00" * Displays value in the scripted field ("Meeting Start") import com.atlassian.jira.component.ComponentAccessor import…
-
Does this need to be accomplished with behaviours? It sounds like this would be more suited to be done in a listener. For example, you can make a listener that fires on an Issue Created or Issue Updated Event (or all Issue Events). If someone updated the Priority field, check to see what the original value was and what it…
-
Your script is very close, though I am not sure what the setserverName() method is from. This script should work in a listener, just put in the name of your server name custom field: import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.Issue import com.atlassian.jira.issue.ModifiedValue…
-
Hi Ashley, I have another solution that seems to work. I created a scripted field named EpicSum. It looks to see if the issue is of type Epic. If it is, find all issues in that epic. Once it has those issues, it looks at the custom number field "NumField" and sums up the total value between all issues in the Epic. import…