Comments
-
Hi George, Thanks for clarifying that. OK, so we just need to figure out how to calculate the correct date. It seems like it would be simple, but it is tricky sometimes. Could you please answer these questions as well: 1) What type of custom field is 'Upcoming Fiscal Year Date'? Is it a Date Picker, a Date Time Picker, or…
-
Hi Melissa, Are you using ScriptRunner for JIRA Server? If so, which version of SR and JIRA are you using? I just tested out this validator and it works for me to force the user to make a change on all fields.
-
Hi Davor, This should be possible. Essentially, you'd just need to get the users out of the group and then set the field with those users. I answered a similar question here: https://community.atlassian.com/t5/Jira-Service-Desk-questions/Using-Scriptrunner-to-define-approvers-based-on-multiple-groups/qaq-p/664935#M8176 Use…
-
George, Before we can fix the date calculation, we need to fix other parts of your script. In your script below, it seems there is an error with getting the field value. You are calling getCustomFieldObjectByName('customField_11'). Surely, that is not the real name of the field, is it? What is the actual name of the field…
-
This is good. I was going to suggest something similar. Let us know if you need more help @Kelly Besmar.
-
Glad to hear it is working! Thanks for using ScriptRunner!
-
Hi Jordan, That sounds frustrating! Glad to hear you have it working now. Thanks for using ScriptRunner!
-
Hi Srinivas, I tested this script below in my instance as a listener. Whenever the parent issue gets updated, it will get all of the subtasks from the issue and set their assignee to the parent issue's component lead. I added an "if" statement to prevent the script from updating subtask issues that are in "Testing" or…
-
Are you sure your workflow step has a "Fire event"? Go to your workflow step and verify that the events are actually being fired.
-
Hi George, Where are you using this script? In a Scripted Field, post-function, etc? Looks like you are also missing an import for ComponentAccessor. import com.atlassian.jira.component.ComponentAccessor def customFieldManager = ComponentAccessor.getCustomFieldManager() def dateFieldObject=…
-
For Simple Scripted Conditions, cfValues['Field Name'] will check whether someone enters something in the field during the transition. It gets the contents of the field that is currently present on the form.
-
Hi Jordan, Your condition looks fine, but could you clarify your workflow? Does the issue already have a resolution of "Fixed" and you want to add a validator for when someone changes the resolution to something else FROM "Fixed"? Or this is validator for when someone changes the resolution from something TO "Fixed"? I…
-
Is this for ScriptRunner JIRA Cloud or ScriptRunner for JIRA Server? You're getting that error because you have a "Date" object and you are trying to subtract something that is not actually a "Date" object. Most likely, you need to cast the value you are trying to subtract as a "Date" object. See example script below:…
-
Glad to hear, Robert! Thanks for using ScriptRunner. :) Josh
-
Hi @[deleted] Glad to hear it worked. Please accept my answer as the accepted answer so others with the same problem can find the solution easier. Thanks for using ScriptRunner! Josh
-
Hi Robert, In my fast-track transition listener, I set it up to fire on "Issue Commented" events. For my condition, I wrote a script that gets the last comment on the issue and searches the comment for a specific email address. If the comment contains that email address, the condition will return true and the fast-track…
-
Hi Srinivas, I agree with @Nic Brough -Adaptavist- that making the "Moderator" field a user-picker field would simplify things a bit. To set the "Moderator" field to the component lead assuming there is only one component, the script would look something like this: import com.atlassian.jira.issue.Issue import…
-
Hi Carol, Do you still need help with this? I would perhaps try using updateValue(), as it will persist the change to the database. import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.CustomFieldManager import com.atlassian.jira.user.ApplicationUser import…
-
Hi Swathi, Have you tried adding your groups to a list and then setting the field using that list? import com.atlassian.jira.component.ComponentAccessor def customFieldManager = ComponentAccessor.getCustomFieldManager() def groupManager = ComponentAccessor.getGroupManager() def multiGroupCf =…
-
Hi Tomas, I believe @Ashraful Hasan [Adaptavist] answered your question through our support portal. You no longer need help with this, correct? Feel free to post the script here if you'd like to share it with others. :) Regards, Josh
-
Hi Sergio, You seem to be missing a definition for customFieldManager. Also, I am not sure where you are using this script, but you might need to use the updateValue() method. import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.ModifiedValue import…
-
@Alexey Matveev Good point :)
-
Hi Kevin, I think your best bet would be to set up a workflow post-function. The post-function would work something like this: * An issue is transitioned through the workflow * Post-function checks to see if the issue type is "sub-task" * If the issue is a "sub-task", update the custom field value on the parent issue *…
-
Hi, Your script looks correct from what I can tell. I believe the WebSudo error simply means your session has expired. You'll need to just log out of JIRA and log back in and try to run it again. Regards, Josh
-
I think what you are trying to accomplish can be done with behaviours by adding a condition to see which screen the user is on. Here is some sample code to get you started: You can use the following to apply the behavior to a specific screen to validate input. if (getFieldScreen().name == "Some Screen Name") { // check…
-
Hi Daniel, I think @Alexey Matveev essentially gave you the correct answer, but you just need to apply it as a post-function that fires a condition when true and not strictly as a validator. For example, your condition would be this: if (transientVars.get("comment")) { log.debug("User has entered a comment on the…
-
Hi Cary, The collects I'm doing should actually not be nescessary... I am guessing you attempted your own changes just by doing def usersFromBothGroups = usersinGroup1.intersect(usersinGroup2) with no sort of collect{} closures. That should work, but unfortunately it does not for reasons unknown to me. I had to resort to…
-
Hi Cary, We should be easily be able to do this - the Atlassian API specifically has a isUserInProjectRole method to check if a given user is in a project role for a given project. Let me know if the script I provided works as expected and then we will proceed with the next step. Josh
-
Hi Cary, This script should intersect the two groups so you will only get Approvers that are found in BOTH groups. import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.ModifiedValue import com.atlassian.jira.issue.util.DefaultIssueChangeHolder def issue = event.issue def groupManager =…
-
Hi Manu, which version of ScriptRunner and JIRA are you on?