We are migrating to the Cloud and I need help with these post-fucntion scripts that are currently working on JMWE Server. The scripts were written by the legend David Fischer and I'm hopping he can read this, if not, any help will be much appreciated.
Script #1: it looks for the last number in a dropdown and adds one more to use it in the second script:
def issues = jqlSearch ('"URD ID Sequence (OJSBOX)" is not EMPTY ORDER BY "URD ID Sequence (OJSBOX)" DESC',1)
def max = 1
if (issues.size() == 1)
max = issues.first().get("customfield_18018") + 1
return max
Script #2: this other script will be adding a string to a text field, it will get the text in parentesis in the Component, the last 16 characters in the fix version and it will add at the end the number collected in the fisrt script:
import org.apache.commons.lang.StringUtils;
if(issue.get("components")){
def comName = issue.get("components").first().name
def Version = issue.getAsString("fixVersions").substring(16)
return "${Version}-${StringUtils.substringBetween(comName, "(", ")")}-${String.format("%05.0f",issue.get("customfield_18018"))}"
}import org.apache.commons.lang.StringUtils;
if(issue.get("components")){
def comName = issue.get("components").first().name
def Version = issue.getAsString("fixVersions").substring(16)
return "${Version}-${StringUtils.substringBetween(comName, "(", ")")}-${String.format("%05.0f",issue.get("customfield_18018"))}"
}
***Example Data***
Component/s: AI ML - Intelligent MedDRA Coding (IMC)
Fix Version/s: LifeSphere MultiVigilance 2022.2.3.0
Correlative Number: 00007
An this is the URD ID we are getting: 2022.2.3.0-IMC-00007
Thanks in advance for your help.
Hi @Cesar Duran ,
for the first script, something like this should work:
{% set issues = '"URD ID Sequence (OJSBOX)" is not EMPTY ORDER BY "URD ID Sequence (OJSBOX)" DESC' | searchIssues(maxResults=1, fields="customfield_18018") %}
{% if issues %}
{{issues[0].fields.customfield_18018 + 1}}
{%else%}
1
{%endif%}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi again @Cesar Duran
for the second script, try something like:
{%set comp = issue.fields.components | first | field("name") %}
{%if comp%}
{{issue.fields.fixVersions[0].name.substring(16)}}-{{comp.match(r/^.*\((.*)\).*$/)[1]}}-{{(issue.fields.customfield_18018 | string).padStart(5,0)}}
{%endif%}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Let me add a couple of screenshots of the postfunctions in Jira Server:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.