Comments
-
Hi Stéphane, No worries :) I am glad you found your problem. Thanks for using ScriptRunner!
-
Hi Stéphane, Are you using Jira Sever or Jira Cloud? I have tested a post-function on server according to your specifications and it works for me. Could you go to the workflow step that you've added the post-function on and ensure that the post-function is the last item to be executed on the workflow step? If the…
-
Hi Syke, This is for JIRA Sever. Are you on the Cloud version?
-
Hello Aleksey, The problem with your script is that you need to get the underlyingIssue (not just issue) in order to use this in a behaviour. Also, removeIssueLinks() does not accept a MutableIssue as a parameter, so you shouldn't define currentIssue as a MutableIssue. This is the script that worked for me to remove linked…
-
I would think that there are two issues here. 1) I see that your question is tagged with Jira Service Desk. Unfortunately, there are compatibility issues between behaviours and Jira Service Desk. You can read more about this problem here: https://productsupport.adaptavist.com/browse/SRJIRA-728 2) Your script may be…
-
You are getting those static type checking errors, but have you tried to ignore those errors and just proceed with running the script anyway? The static type checker isn't always an indication that the script will not work.
-
Hello Meng Ge, Your script looks almost correct to me. I wrote this script: def secondCategory = getFieldByName("Category") // your field name here def description = getFieldById("description") if (secondCategory.getValue().toString().contains("AAA")) { description.setFormValue("Request Template")…
-
I am not sure if you can automatically do this with ScriptRunner, since it seems to be an outstanding feature request on our support portal here. You might be able to hack something together using MoveIssueBean, but it seems rather complicated based on previous discussion. You can already do bulk changes based on specific…
-
Hi Sar, Which version of SR and JIRA are you using? This script works fine for me. Have you made sure that you added the validator to the correct workflow step? Could you try adding a logging statement to see which groups the currentUser is in? import com.atlassian.jira.component.ComponentAccessor def groupManager =…
-
Hi Magnusep, Questions like these are better suited for our support portal. We monitor our support portal continuously for problems with the plugin. To answer your question: I believe you are experiencing a rather recent bug. SRJIRA-2388 causes @PluginModule to not correctly load classes. The workaround is to…
-
Hi Ash, Sorry about that, that script contained a small error. However, I think that script will not work for you anyway. Could you clarify the relationship between Issue A and Issue B? Is this correct: * Issue A is the parent issue * Issue B is a sub-task of Issue A In that case, a script like this should work: import…
-
You can get the current date like this: Date date = new Date() And then you can cast your custom field values to a Date like this: def dtStartDate = issue.getCustomFieldValue(strStartDate) as Date Your script should look something like this, but I haven't tested it: import com.atlassian.jira.issue.Issue import…
-
Are you wanting to do this in a behaviour? You can use behaviors to modify the visible/required fields on a screen. You can use a scripted transition to limit the behaviour to a particular workflow step, so that it's only applied on the relevant transition screen. You could add a script to a behaviour with something like:…
-
Glad to hear it is working, Clayton. Apologies that I could not get back to you sooner. Thanks for using ScriptRunner!
-
Hi Rashmi, All you need to do is remove the first line of code. The package name is not necessary and will cause an error. import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.customfields.option.Option import com.atlassian.jira.issue.fields.CustomField import…
-
Hi Clayton, Thanks for the information. The fields you are using are checkbox fields, right? In that case, getting the custom field value of a checkbox field will return an array of values, e.g. if someone selects 'Yes', the value returned will be: [Yes]. You should perhaps try calling the contains() method on the checkbox…
-
You have def valueApp1 = issue.getCustomFieldValue(actionAptos).toString() But actionAptos is not defined anywhere in your code? You should be passing in the custom field object that you got the line before ("actionApp1"): //resources import com.atlassian.jira.component.ComponentAccessor import…
-
Hi Ash, You could create a scripted field that gets values from issues that are linked. For example, if Parent issue A was of type "Bug", the code for your scripted field would look like this: import com.atlassian.jira.component.ComponentAccessor def issueLinkManager = ComponentAccessor.getIssueLinkManager() def…
-
Hi Stanislav, I think that a ScriptRunner behaviour would work better for this. You could add a behaviour to the customField you want to hide. Using a server-side script, you could hide the field on the create screen like this: def customField = getFieldByName("TextFieldA") customField.setHidden(false) // check to see…
-
Hi Yun, Could you provide more details as to what you are trying to accomplish? Let me see if I understand correctly: * You have a custom field of type "Multi-select" list * Users can select types of "Projects" from the Multi-select list * If they select certain projects, you want to clone the issue You could accomplish…
-
Hi Dimitry, Were you able to figure out the problem yet? If you have not, I would suggest making sure that your post-functions are in the correct order on the Create transition. Your post-function should be the last item for execution:
-
Hi Ashish, Were you able to figure it out or do you still need help with this issue? Josh
-
Answered on product support: import com.atlassian.jira.issue.MutableIssue import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.event.type.EventDispatchOption def issue = issue as MutableIssue String subject = issue.summary //gets the summary int indexfind //Help Index to Find "Priority:"…
-
Chiara, Could you please clarify? * Are you using ScriptRunner? If so, which version of ScriptRunner? * Why must this be done in JavaScript if you are using ScriptRunner? Showing or hiding a custom field based on the value of another field is a very basic feature of ScriptRunner Behaviours. It should not be very hard to…
-
Hi Chiara, I understand what you are trying to accomplish, but I do not know why this must be done in JavaScript. Why not add server-side Groovy code for the behaviour attached to the field you want to modify? For instance, you could write something like this. * Code attached to a Select List Field * Check value of the…
-
Hi Swapnil, You are using this code inside of a scripted field, correct? Which version of ScriptRunner are you using?
-
Hi Sarathi, Glad to hear that it worked. If you wouldn't mind, please choose my answer as the best answer so that others in the community can find it easier.
-
Hi Michaella, I would guess that the condition is not the problem, but rather that your post-functions are out of order. Whenever you add a post-function to your workflow step, make sure you move the post function to the very last step. The order should look like this: If you've ensured it's on the right step and published…
-
You could create a scripted field with a script like this: def summaryList = [] issue.getSubTaskObjects().each { subtask -> summaryList.add(subtask.summary) } return summaryList.join(', ') It will get all of the sub-task objects of an issue, get the summary from each, and then add that summary to a list. You can then…
-
You should also make sure that the Template for the Scripted Field is set to "Number Field" and that the Searcher is set to "Number Searcher".