PD Sheehan Expert

Comments

  • Well I think the problem is with your sql statement itself. updateCount = sql.executeUpdate ('UPDATE dummypeopledata SET personlocation where first_name=?', newLocationValue) You won't find a row with first_name=newLocationValue. ANd you are not actually specifying anywhere what value to set on the personlocation field…
  • This works for me using just the created date (don't convert to time). Have you set the searcher to "Date Time Range" in the field edit screen? Also, I generally have a philosophical problem with repeatedly calculating a field to obtain a value that will be set once and never changed. That seems like a lot of compute…
  • That is normal and expected. The syntax checker is just a warning that something "might" be wrong. But it can't know what are the possible columns from the GroovyRowResult. A different, but functionally equivalent syntax to get a column value is to use personRow['column name'] and that will pass the static type checker.…
  • Just as the error implies, you can't have "def row " twice. Here is your full script, corrected as best as I could: import com.atlassian.jira.component.ComponentAccessor import com.onresolve.scriptrunner.db.DatabaseUtil import com.atlassian.jira.event.issue.IssueEvent import com.atlassian.jira.issue.ModifiedValue import…
  • Hi @Jason Galea Could it be as simple as a typo between the priority value of "N/A" and the the script using "NA"? Other than that, your simple scripted validator seems fine. To test it, go to the scriptrunner console and add try the following (put an issue key with priority is NA) import…
  • I don't think you can just "move" a user. You could create a new user in your internal directory then delete it from the ldap directory. Note that when you do that, users would lose group membership maintained in jira. So your script might also need to manage that. But I don't think you will be able to store the user's…
  • That might be something specific to your environment. You should make sure you are able to make a simple (like just GET without authorization) request and work it out from there.
  • Hi @Sekhar Chandra I see potentially 2 errors in def http = new HTTPBuilder('https://abc.googleapis.com/v1/projects/$project/topics/$topic:publish') 1) $variable are not expanded in strings with single quote. 2) $project and $topic are not defined yet when you initialize the http object This it like this: import…
  • The problem might be that def row = sql.firstRow is inside the first withSql block. Try it like this: def row DatabaseUtil.withSql('Dummy People Data') {sql -> row = sql.firstRow('SELECT * from dummypeopledata WHERE first_name = ?', value) if(row){ /*...*/ } } row.'personlocation' //this is now available ourside the sql…
  • If the resource definition was configured with a user with write permissions, the reference I gave you should include everything you need. But specifically, some code like this should work: import com.onresolve.scriptrunner.db.DatabaseUtil DatabaseUtil.withSql('your_resource_name') { sql -> sql.execute('update mytable set…
  • The scriptrunner resource accessed using DatabaseUtil... import com.onresolve.scriptrunner.db.DatabaseUtil DatabaseUtil.withSql('local_jira') { sql -> //some sql action here } ... generates a groovy slq object. You can read the full reference for using that here: https://groovy-lang.org/databases.html But when you see…
  • I was searching for something else and saw this post. I know this is not an answer, but there is an add-on that provides this functionality: https://marketplace.atlassian.com/apps/5228/show-saved-filter-with-columns-for-jira?hosting=server&tab=overview In addition to storing the JQL within the gadget preferences, it also…
  • If you enable in-line edit, the behaviour code will not run at all and you will not be able to prevent users from violating your rules. Behaviour is only capable of running within the context of a create/edit/transition screen and prevent the submission before the change is saved. There is no "validator" concept for…
  • Hi @aleksandr_pavlovic Can you supply some additional context, examples, screenshots? For starters, where is "START_DATE" defined? How are you reviewing the content of var_StartDate?
  • Hi @Kay Behaviours don't work in InvalidInputExceptions(). Instead, you have to use the formField.setError(errorText) method. You will need to make sure the same script is present as server-side script on each date field as changing either date fields should trigger the script to validate the input. Try something like this…
  • Have you looked to see if users have customized their create screen? If they have, then you will know how to replicate as an admin and tweak your script accordingly. I know that behavior can't override the user's preference and show the field. And I'm not sure if there is a way to detect that a field is hidden like that. I…
  • Hi @Ander Yes, this approach should work. You have identified the correct item to hide. As for the condition despite the fact that the fragment is called "hide element", we must return a "false" value to hide and "true" to show the element. There is no direct access to issue links from the issue object. To get issue links,…
  • def fieldConfig = lobPrograms2.getRelevantConfig(issue) def fieldConfig2 = lobProject2.getRelevantConfig(getIssueContext()) def fieldConfig3 = lob2.getRelevantConfig(issue) These fiedConfig and fieldCongfig3 will fail on create screen. Buf fieldConfig2 will be fine. This means that getOptions and getOptions3 will also be…
  • You should only need to have your script on the field that actually triggers the change. Unless you want some default values to be applied before the user makes any selection. Then that would have to be in the initialiser. But perhaps there is something that your script does in terms of looking up values that uses an issue…
  • You're only changing the issue type. If the other issue type has a different workflow, the old workflow will still be associated to the issue. There may also be different required fields for the new issue types. Changing an issue type in the UI requires going through the whole MOVE operation. Not something very easy to do…
  • Duration expects a <Long> number of seconds. Jira stores/returns dates as java.sql.Timestamp If you use getTime() you will get millisecond values since January 1, 1970, 00:00:00 GMT. So putting that together, you can do this: def durationMillis = secondDateValue.getTime() - firstDateValue.getTime() def duration =…
  • First, let's have a look at your condition: import com.atlassian.jira.issue.Issue; import com.atlassian.jira.component.ComponentAccessor; import com.atlassian.jira.issue.comments.CommentManager; import com.atlassian.jira.user.ApplicationUser; import com.atlassian.jira.issue.fields.CustomField; import…
  • Try to force the log level: import org.apache.log4j.Level log.setLevel(Level.DEBUG) This will ensure that whatever class the logs are associated with, will be included in your logging at the desired level.
  • You could store the url in the description of each project using some html tag (so that the url doesn't show when viewing the project) and use some string manipulation or regular expression to extract the URL. Or you could use the OfBizProperty system. But with that, you will need to use some scripting to store the url for…
  • Ah... I was assuming server. You are on cloud. I don't know the cloud API. I can't see from the documentation if that is possible. It doesn't appear to be. Which is strange. Sorry I can't help you more. Try raising a service request at https://productsupport.adaptavist.com/servicedesk/customer/portals they are pretty…
  • They will just appear as "not executed"
  • The full API documentation is available here: https://docs.adaptavist.io/tm4j/server/api/v1/ Look at /testrun/{testRunKey} testRun is the old name for testCycle The GET request will return an item attribute. This is an array of test cases.
  • That might be a bug/design flaw in scriptrunner. Try to put the same webitem on a page menu instead. For this web fragment config to work, scriptrunner has to make sure they deploy some javascript in a given context that will listen to this link-click event and create a dialog instead of using the default behavior of the…
  • I haven't played a lot with this, but I think it's like this: The Search SQL controls the list of values that will be available in the drop-down. It appears to expect 2 columns returned. The first one will be the value stored with the issue as the custom field value. The second is what you see in the drop-down. You would…
  • No, behaviour server-side script can only run in the create, edit or transition screens. Normally, when you add a field to the behaviour fields's configuration, that field's inline edit becomes disabled and will automatically open the full edit screen. This way, your validation rules will always be enforced.