Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Problem with script runner with multiple cutom post function

Hi All,

Am trying to create 3 linked issues using clone script runner on post-function,

I added a condition on each post function: in case I change one field the post function related will execute successfully in case I modify 3 fields 3 related issues should be created. this is the happy scenario. what is really happening that in the second scenario only the first condition is executed while the others is not.pic1.png

thank you.

 

1 answer

1 vote

Hi @Bashar Haydar 

Can you post the three conditions you are testing?

Also check the jira log files for any errors thrown during the transition.

Hi Tom thank you for your reply no errors found all green, I attach the conditions

thank you

 

 

pic2.pngpic3.pngpic4.png

tom lister Community Leader Mar 10, 2019

Hi @Bashar Haydar 

I see you are looking for the last change history on each case but the action of cloning with a link may be adding to the change history so affecting subsequent checks. I’d need to get to a server to prove that. Can you log the change history in each function?

Hi Tom,

what you mean in log the change history, you need me to add log.error() of what, sorry am new in Jira :)

thank you,

I used log.error on each function the first and third  functions returned:

2019-03-10 19:54:03,894 ERROR [workflow.ScriptWorkflowFunction]: [com.atlassian.jira.issue.history.ChangeItemBean@3fab96f8[fieldType=jira,field=status,from=1,fromString=In Progress,to=1,toString=In Progress,created=2019-03-10 19:54:03.13], com.atlassian.jira.issue.history.ChangeItemBean@415709d3[fieldType=custom,field=PC,from=[12526, 12530],fromString=Internet Access,Citrix Access,to=[12530],toString=Citrix Access,created=2019-03-10 19:54:03.13], com.atlassian.jira.issue.history.ChangeItemBean@7aed0420[fieldType=custom,field=Procurement,from=[14605, 14606, 14607, 14609, 14610],fromString=Printer,IP Phone,Mobile,Laptop,Screen,to=[14605, 14606, 14607],toString=Printer,IP Phone,Mobile,created=2019-03-10 19:54:03.13], com.atlassian.jira.issue.history.ChangeItemBean@4205941b[fieldType=custom,field=IT Software,from=[14620, 14819, 14820, 14617, 14618, 14824, 14616, 14823, 14825, 14826, 14827],fromString=Airas,Airas Test,Bank Med,Dynamics CRM,IMACC,IMACC Stock,Jira,MACC Payroll,Raga,SAS,YES,to=[14620, 14819, 14820, 14617, 14618, 14824, 14616, 14823, 14825],toString=Airas,Airas Test,Bank Med,Dynamics CRM,IMACC,IMACC Stock,Jira,MACC Payroll,Raga,created=2019-03-10 19:54:03.13]]
Cancel

 

the second

 

2019-03-10 19:54:03,894 ERROR [workflow.ScriptWorkflowFunction]: [com.atlassian.jira.issue.history.ChangeItemBean@3fab96f8[fieldType=jira,field=status,from=1,fromString=In Progress,to=1,toString=In Progress,created=2019-03-10 19:54:03.13], com.atlassian.jira.issue.history.ChangeItemBean@415709d3[fieldType=custom,field=PC,from=[12526, 12530],fromString=Internet Access,Citrix Access,to=[12530],toString=Citrix Access,created=2019-03-10 19:54:03.13], com.atlassian.jira.issue.history.ChangeItemBean@7aed0420[fieldType=custom,field=Procurement,from=[14605, 14606, 14607, 14609, 14610],fromString=Printer,IP Phone,Mobile,Laptop,Screen,to=[14605, 14606, 14607],toString=Printer,IP Phone,Mobile,created=2019-03-10 19:54:03.13], com.atlassian.jira.issue.history.ChangeItemBean@4205941b[fieldType=custom,field=IT Software,from=[14620, 14819, 14820, 14617, 14618, 14824, 14616, 14823, 14825, 14826, 14827],fromString=Airas,Airas Test,Bank Med,Dynamics CRM,IMACC,IMACC Stock,Jira,MACC Payroll,Raga,SAS,YES,to=[14620, 14819, 14820, 14617, 14618, 14824, 14616, 14823, 14825],toString=Airas,Airas Test,Bank Med,Dynamics CRM,IMACC,IMACC Stock,Jira,MACC Payroll,Raga,created=2019-03-10 19:54:03.13]]

 

 

I think am going to replace these 3 post function (clone and link issue) with one post function what do you think?

thank you.

 

 

 

tom lister Community Leader Mar 11, 2019

Hi @Bashar Haydar 

sorry about slow response, had to do day job!

As you are creating issues in different projects I don't think you have the option of using one post function without a lot of coding.

Can you log.info the conditional clause

i.e.

changeItem.find{it.field == "Procurement"}

and establish whether they are evaluating as you expect

Alt syntax is

{it.field.equals("Procurement"}

Hi @tom lister ,

in case i would like to map fields from main tickets to related tickets using script runner:

1. Option1=Insight object

2. Option2= Multiple selection

3. Option3 = User 

any help, thank you

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Jira Core

How to manage many similar workflows?

I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...

3,881 views 11 5
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you