Trying to make a workflow that will update the state of Ticket A when the state of Ticket B becomes a given state

Prerequsites:

One Dev project with HC.Release.State Field
One QA project with HC.QA.State Field

A Link Type (QA);
Outward = QA For
Inward = QA by
Direction = Aggregate

I have a Dev Project issue linked to a QA project issue with a QA link (QA -> Dev)

For the workflow I have:

rule Alert QA to Fix

 when Issue.HC.Release.State.becomes({Complete - Ready For Testing})
{
  for each Ticket in QA by {
    Ticket.HC.QA.State = {Ready For QA};
  }
}

Which does nothing

The Workflow is attached to both the Dev and QA project.

Can anyone spot what is going wrong?
14 comments
Comment actions Permalink
Do you complete all references by Ctrl+Space? Could you please attach the workflow zip?

You can also add the debug output: message(Ticket.getId() + "") (will appear on the screen) or debug(Ticket.getId() + "") (find output in the logs/workflow.log).
0
Comment actions Permalink
Hi Dmitry,

Do you complete all references by Ctrl+Space? - Yes

Could you please attach the workflow zip? - Sure, see attached

You can also add the debug output: message(Ticket.getId() + "") (will appear on the screen) or debug(Ticket.getId() + "") (find output in the logs/workflow.log). - Added both inside the for loop:

rule Alert QA to Fix

 when issue.HC.Release.State.becomes({Complete - Ready For Testing})
{
  for each Ticket in QA Ticket {
    Ticket.HC.QA.State = {Ready for QA};
    debug(Ticket.getId() + "");
    message(Ticket.getId() + "");
  }
}

No output is created logs/workflow.log and no message is displayed when I go through the use case. I guess the workflow rule is not reaching that point.

Thank you for your help, hope to hear from you soon.
0
Comment actions Permalink
Please attach the workflow here as zip archive.

Are you sure that the current issue has as least one 'QA by' link?
0
Comment actions Permalink
I thought I did, trying again.
0
Comment actions Permalink
adding a file is not working
0
Comment actions Permalink
The current issue has exaclty 1 'QA by' linked issue, though I have changed this to 'QA Ticket' in the latest version
0
Comment actions Permalink
Do you change state to the {Complete - Ready For Testing}? You can add debug info before the loop to ensure in it.
0
Comment actions Permalink
Do you change state to the {Complete - Ready For Testing}? - Yes

Added a message before the loop, nothing happens when I change the state. Other workflows applied to this project are working.

rule Alert QA to Fix

 when issue.HC.Release.State.becomes({Complete - Ready For Testing})
{
  message(issue.getId() + "");
  for each Ticket in QA Ticket {
    Ticket.HC.QA.State = {Ready for QA};
    message(Ticket.getId() + "");
  }
}
0
Comment actions Permalink
Aren't there any errors on the workflow page? Bad workflows are highlighted by red line.
0
Comment actions Permalink
Good call, I get a "Rule is not applicable for the project" warning.

Is this because the {Ready for QA} state is not present in the development project and the {Complete - Ready For Testing} state is not in the QA project?

I want a change in the development project ticket's state to affect the linked QA project ticket's state, is it necessary to have the same state bundle in each?
0
Comment actions Permalink
Unfortunately you cannot access fields and values from a project the workflow isn't attached to. As workaround you can use applyCommand("HC.QA.State Ready for QA") method to set state.
0
Comment actions Permalink
I have attached the workflow to both projects already, is this not sufficient, wouldn't intellisense not show the states in the workflow editor if they are invalid?
0
Comment actions Permalink
This is working for me as expected, thanks for your help.

rule Alert QA to Fix 2

 when issue.HC.Release.State.becomes({Complete - Ready For Testing})
{
  for each Ticket in QA Ticket {
    Ticket.applyCommand("HC.QA.State Ready for QA");
  }
}
0

Please sign in to leave a comment.