Problem with script runner with multiple cutom post function

Bashar Haydar March 9, 2019

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
Tom Lister
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 10, 2019

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.

Bashar Haydar March 10, 2019

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
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 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?

Bashar Haydar March 10, 2019

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,

Bashar Haydar March 10, 2019

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
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 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"}

Bashar Haydar July 4, 2019

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