Hi,
I have the below snippet of code to ensure "Work Type" field is filled in order for the issue to move to DONE.
def workType = GetWorkType(issue);
if(workType == null || workType.isEmpty())
{
errors.add("Work Type is required to accept this ${issueType}");
}
How do I limit this code to not include RISK issue type alone?
Thank you
Hi,
You could use
if (issue.getIssueType().getName() != "Risk"){
}
if I got it right.
Thank you for the comment. Where must I add the above line , with respect to the scriptI have shared.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
That would be the first line of the script I guess. Place your script inside this condition.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Something like this, ?
if (issue.getIssueType().getName() != "Risk"){
def workType = GetWorkType(issue);
if(workType == null || workType.isEmpty())
{
errors.add("Work Type is required to accept this ${issueType}");
}
}
Thanks
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.
Need to restrict the Issuetype (bug) movement to only particular issue types (story or task) , User (role wise) should able to move only to particular issue type mentioned not all the available issue types.
Is that possible ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Afaik it is possible with the clone plus plugin (which I am using). If you need more assistance I would advise to raise a new question.
Antoine
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Antoine Berry Is that possible using scriptrunner or any other plugin. Because we don't use the Clone plus plugin.
Regads
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Maybe you could create a custom web section, but I do not know if it can fullfill all your requirements...
I have not done it so if you face any difficulty you should raise a new question so the community can help you.
Good luck !
Antoine
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.
Hi @Aisha M ,
Sorry I was out of office for vacations. Do you still have the issue ? The answer on this topic seems correct.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Antoine Berry Please don't be sorry :) You are already doing such an amazing help :) And yes, the issue has been fixed :) Thank you !
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.
Hi @Aisha M ,
It looks like you got plenty of help from experts, I agree with what they said, you should probably set the date value in the create post-function !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Antoine Berry Thank you so much for looking into it :):) Until I get the go from you, I just couldn't finalize on anybody s answer. . :D You always give the best possible solution !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ahah, I do my best, but these guys are probably better :) Let me know if you need further help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Antoine Berry Well regrading that workflow post function question. My team doesn't want to add the post function to every workflow. They are suggesting something like, a script runner script that checks the value every (whatever frequency we determine), and fills it in? You think that is possible
Thank you
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.
@Antoine Berry I was told to look if script listeners could be used :( My team does NOT want to use post functions for some reason :D
And just a quick question, while writing scripts, how should we include multiple types,
For example, If i want to include RISK & TEST in below code,
if (issueType != "Risk")
Should it be,
if (issueType != "Risk","Test") (OR) if (issueType != "Risk""Test")
Thank you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Aisha M you could absolutely create a script listener on the Create Issue event. Make sure you are triggering this event in the workflow. If you need actual help you can open a new thread.
As for the script you could use
issueType in ["Risk", "Test"]
or
issuetype == "Risk" or issueType == "Test"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Antoine Berry I will open a thread for it then :) Thank you . .
Well, I tried as below,
if (issueType != "Risk") && (issueType != "Test")
(issueType != "Risk") || (issueType != "Test")
Actually, this works fine for Risk, but doesn't work for Test (actually its for the same question as this original thread, but we are extending it to TEST issue type as well)
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.
@Aisha M , If you want your script to not execute when issue type is Risk or Test, you should use :
if (issueType != "Risk" && issueType != "Test"){...
If this does not work for Test, this means there is a type. Add
log.error("issuetype: " + issueType)
and make sure it is exactly "Test"
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.
@Antoine Berry Hi Antoine. Can you please help me with Listeners in the below thread please,
Would really appreciate your help :) Thank you !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Aisha M ,
Did you try the solution he suggested ? Are both the date fields custom fields ? Date pickers ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Antoine Berry Yay yer back ! :)
You mean with he post functions ? Well, that didn't work, but I was being sternly told not to use Post functions, and stick to script listeners or scriptrunner
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The code in post functions and script listeners would be the same :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Antoine Berry Oh, is it ? I have never used listeners. Can you please help me on how to use listeners for this ? :)
Also, can you please reply in the above thread, so that I can mark your answer :) Should be helpful if anyone wants to try a similar thing :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes I will take a look at it. Please tell me the configuration of the two fields, are they both date pickers ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Antoine BerryThank you ! Below are the details
Field 1) Epic Due Date
Field 2) Baseline Due Date (Date picker)
I want to make sure that Field 1 copies the value of Field 2 the FIRST time its filled while the issue is created. Later , even thought the Field 2 value might be changed, the field 1 must not change its value and must be non editable (only viewable).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am not sure to understand. Are they both custom fields ? So "Epic" due date has nothing to do with an Epic ? Is one of them the Due Date system field from jira ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Actually both are custom fields. Not the inbuilt one from JIRA
Basically both of these fields will be available at Epic issue type
And Field 1 should not be editable (only be viewable) on the issue card.
So, this field 1 must pick the first value entered for field 2.
Field 2 is editable and can be changed multiple times.
I hope I was able to explain :(
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Antoine Berry Hope you are doing good. :)
If possible, can you please help me with your thoughts on the below question,
Would really appreciate your help. Thank you
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.