Comments
-
I copied your script exactly into my environment and only changed the name of the 2 fields to use 2 of my date fields. It works just fine. That error seems to imply that one of the 2 custom fields is not actually a "date picker" or "date time picker" field, but instead, a free text field populated with a text rendering of…
-
Instead of "toString()" on your select field value (which is an instance of an option object), try to get that option's value. if(capabilityAreaFldValue.value == 'Supply Chain') Also, for this sort of situation, rather than having lots of if blocks, create a map, then use that to find the value to set. def areaMap = […
-
Does it work when you run the Copy Project Script from the ScrptRunner UI under Built-In Scripts?
-
Let me see if I understand correctly. You want to create a new issue in jira. When you click the create button to submit the issue creation form, you would like to run a custom post-function script that will execute an HTTP GET request to some third party tool (perhaps using some attributes entered in the issue creation…
-
IssueLinkType have 3 main attributes: name, outward description and inward description. Looks like you were looking at the value of the outward description and comparing it to the string that matches the name. Try either: def clonedIssues = ComponentAccessor.getIssueLinkManager().getOutwardLinks(issue.getId())?.findAll…
-
I am wondering what your goal is. What's the business requirement? I can see from your code that you are trying to output the value from custom fields xxx and yyy for all the issues in your searchResults (searchResult definition was not included in your initial post). But I don't understand what you want to do with those…
-
I see you are using Jira Server ... why are you using the REST API? You can connect directly to the Java API: import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.user.UserDetails def userManager = ComponentAccessor.userManager newUserData = new UserDetails("fred10@example.com", "Fred F.…
-
I still don't understand what you are trying to do.
-
You won't be able to do that with an existing Single Select field since those values have to exist as Options in the field configuration. But with script runner behavior single select conversion, you can transform a text custom field into a single select and the list of values can be populated from a remote api call.…
-
You are correct that you can only listen for CREATE event. And I think that if your cloning process doesn't include either a summary prefix or clonners linked issue type, then there might not be anything in the event that will identify this as a clone. Basically, if you can't tell from looking at any attribute of the issue…
-
I don't understand your question. * What is CR-2546? Is that a jira issue key? * What types are your customFields? Free text? Select? Issue Picker? * What do you mean by "link"? Do you wish to create an issue link based on the key found in customField?
-
You could instead instantiate a new log with a class name that you control. def myLog = log.getLogger("com.acme.myspecialLog") mylog.debug "this is a debug line" mylog.info "this is an info line" //you can still use the default log class log.info "this is a scriptrunner log" Then, from logging and profiling page in your…
-
JS is not my area of expertise either. You could try something like this: AJS.toInit(function () { var webItemKey = 'key-of-your-web-item'; var customFieldId = 10021; var customFieldDivId = '#customfield_' + customFieldId + '-val'; var customFieldValue = AJS.$(customFieldDivId).text().trim(); var webItem = AJS.$('#' +…
-
Then the next step is to output some logs. Also, you have to convert your allowedResolutions into a Map object import com.atlassian.jira.component.ComponentAccessor import static com.atlassian.jira.issue.IssueFieldConstants.Resolution log.debug "Behavior Test - actionName= ${getActionName()}" if (getActionName() == "Close…
-
You can't using the "Navigate to link" option. The only variable available are $issue and $jiraHelper. But if you select "do nothing" and then use a WebResource item and expose your own javascript to bind the new webItem (using the key from your webItem as the id of the DOM element), then you can use javascript to find and…
-
Will your custom field with user name be a User Picker or a Free Text field? Either way, you should be able to just read that field's value with something like : import com.atlassian.jira.component.ComponentAccessor def cf = ComponentAccessor.customFieldManager.getCustomFieldObjectByName('Some Field with a user') def user…
-
Have you tried with getFieldById("resolution")? System field ids are generally all lowercase. Or, correct your import and use the correct RESOLUTION (without quotes) import static com.atlassian.jira.issue.IssueFieldConstants.RESOLUTION getFieldById(RESOLUTION).setFieldOptions()
-
Can you post your full code in a properly formatted code block? At the very least, there is a missing closing }. It's hard to know what else might be missing. But at first glance ... "it.toString()" should be "it.value" or "it.getValue()" def customField =…
-
Ok, I had to set up this test in one of my workflow with some additional log outputs ... but I figured it out. The "component.lead" doesn't actually return a user object, so we can't apply that value directly to the custom field. Try this instead: import com.atlassian.jira.component.ComponentAccessor def customFieldManager…
-
Try to put the post function before the create the issue originally. The scripted postfunction will still receive a "temporary" issue object (that exists just in memory). Then your script will update that object's attribute with the new custom field data and pass that the "create issue originally" which will store that…
-
You can probably simplify this a bit. import com.atlassian.jira.component.ComponentAccessor def hasComments() { ComponentAccessor.commentManager.getComments(issue).size() >=1 } def isUserInBypassGroup() { def currentUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser def bypassGroup = 'Workflow validator bypass…
-
My experience is that the whatever javascript that scriptrunner deploys to support the “Run code and display a dialog” is not available in all contexts. Specifically, in project setting and other admin screens as well as in agile boards, that action doesn’t work. What I've done is selected the “run code and do nothing” and…
-
I believe them to be functionally the same. There may be performance differences but I haven’t seen it tested. I know that scriptunner have tied their functions to the issueFuction custom field that they deploy for performance reasons. But maybe jtricks used some other optimization trick. I think few people are likely to…
-
You don't need to call updateIssue if the postFunction is before the "store the issue in the database" built-in post function. That part will do that work for you. You only need to call this if you make the change after for some reason (maybe you need to wait until the issue is fully created such as when you want to add a…
-
issueFunction in epicOf('jqlQuery'): * provided by scriptrunner add-on * will return the list of EPICS where any of the issues in the epic match the jqlQuery issue in issuesWhereEpicIn('jqlQuery'): * provided by j-tricks add-on * will return the list of ISSUES where the epic matched the jqlQuery
-
getCustomFieldValue on a checkbox field returns an array of options. You can check that with: def customField = ComponentAccessor.customFieldManager.getCustomFieldObjectByName("Merge") def checkBoxValue = issue.getCustomFieldValue(customField) log.info "checkboxValue is of type ${checkBodValue.getClass()}" So to know if…
-
I don't see anything wrong with your code. Let me make sure I understand your intention: * When the user selects a value in custom select 14760* The component field will be set to the component with component.name == option.value * The user picker field 10094 will be set to component.lead So a few questions: * What part is…
-
You could try something like this: import com.atlassian.jira.component.ComponentAccessor def ShowLinks = ComponentAccessor.getIssueLinkManager().getLinkCollection(issue, issue.reporter) ShowLinks.getInwardIssues('Blockers').collect{"""<a href="/browse/$it.key">$it.key</a> """}.join("<br>")
-
I see what you need ... If there are no comments on the issue already, one must be provided when closing. You can achieve this with just your simple scripted validator. You will need to check both the number of comments on the issue if <1 then also check the presence of a comment in the transition. ... return commentCount…
-
Yes, ScriptRunner Behaviours can help you with that. Here is a sample scriptrunner behavior script that will restrict the list to only show the top 3 components. Just add the logic to get the current user's group and map that against a pre-set list of allowed components import com.atlassian.jira.component.ComponentAccessor…