Workflow doesn't work ?
Hey there,
Context : two dev teams, one estimate in time, the other in points.
To smooth monitoring, I've created two workflows :
- A - Conversion of story points into time estimation : this one works perfectly ✅
- B - Conversion of time estimation into story points : this one doesn't work ❌
I don't understand the issue with B, as I've used the same logic as in A, changing the fiels names and value accordingly.
I'll copy below B json model if it helps.
Anybody got an idea ?
{"title":"Conversion estimation temps > Story Point","rules":[{"name":"vfe-1752584770913-0.1229433011321801","title":"On-change 1","triggerType":"onChange","cron":"0 0 0 * * ?","schedule":"","search":"","command":"","properties":{"action":[{"id":"1","name":"ifOperator","params":{"if":[{"id":"2","name":"checkField","params":{"issue":{"type":"Issue","wayOfSearch":"ctx","contextItem":"Issue"},"itemName":"Field","mode":"is","field":"Estimation","fieldType":"period","isMultiValue":false,"state":"1h"}}],"then":[{"id":"3","name":"changeIssueFieldValue","params":{"issue":{"type":"Issue","wayOfSearch":"ctx","contextItem":"Issue"},"userValue":{"type":"User","wayOfSearch":"ctx","contextItem":"User"},"fieldName":"Story points","fieldType":"integer","isMultiValue":false,"value":["1"],"state":"set"}}],"else":[{"id":"4","name":"ifOperator","params":{"if":[{"id":"5","name":"checkField","params":{"issue":{"type":"Issue","wayOfSearch":"ctx","contextItem":"Issue"},"itemName":"Field","mode":"is","field":"Estimation","fieldType":"period","isMultiValue":false,"state":"2h"}}],"then":[{"id":"6","name":"changeIssueFieldValue","params":{"issue":{"type":"Issue","wayOfSearch":"ctx","contextItem":"Issue"},"userValue":{"type":"User","wayOfSearch":"ctx","contextItem":"User"},"fieldName":"Story points","fieldType":"integer","isMultiValue":false,"value":["2"],"state":"set"}}],"else":[{"id":"7","name":"ifOperator","params":{"if":[{"id":"8","name":"checkField","params":{"issue":{"type":"Issue","wayOfSearch":"ctx","contextItem":"Issue"},"itemName":"Field","mode":"is","field":"Estimation","fieldType":"period","isMultiValue":false,"state":"3h"}}],"then":[{"id":"9","name":"changeIssueFieldValue","params":{"issue":{"type":"Issue","wayOfSearch":"ctx","contextItem":"Issue"},"userValue":{"type":"User","wayOfSearch":"ctx","contextItem":"User"},"fieldName":"Story points","fieldType":"integer","isMultiValue":false,"value":["3"],"state":"set"}}],"else":[{"id":"10","name":"ifOperator","params":{"if":[{"id":"11","name":"checkField","params":{"issue":{"type":"Issue","wayOfSearch":"ctx","contextItem":"Issue"},"itemName":"Field","mode":"is","field":"Estimation","fieldType":"period","isMultiValue":false,"state":"1d"}}],"then":[{"id":"12","name":"changeIssueFieldValue","params":{"issue":{"type":"Issue","wayOfSearch":"ctx","contextItem":"Issue"},"userValue":{"type":"User","wayOfSearch":"ctx","contextItem":"User"},"fieldName":"Story points","fieldType":"integer","isMultiValue":false,"value":["5"],"state":"set"}}],"else":[{"id":"13","name":"ifOperator","params":{"if":[{"id":"14","name":"checkField","params":{"issue":{"type":"Issue","wayOfSearch":"ctx","contextItem":"Issue"},"itemName":"Field","mode":"is","field":"Estimation","fieldType":"period","isMultiValue":false,"state":"2d"}}],"then":[{"id":"15","name":"changeIssueFieldValue","params":{"issue":{"type":"Issue","wayOfSearch":"ctx","contextItem":"Issue"},"userValue":{"type":"User","wayOfSearch":"ctx","contextItem":"User"},"fieldName":"Story points","fieldType":"integer","isMultiValue":false,"value":["8"],"state":"set"}}],"else":[]}}]}}]}}]}}]}}],"guard":[{"id":"1","name":"checkField","params":{"issue":{"type":"Issue","wayOfSearch":"ctx","contextItem":"Issue"},"itemName":"Field","mode":"changed","field":"Estimation","fieldType":"period","isMultiValue":false}}]}}]}
Please sign in to leave a comment.
Hi Marion Morazzani!
Can you please share the code for workflow B as well? This will give us better understanding of the conversion mechanism you chose and what might need correcting.
Also, please describe the issue in more detail - how exactly does the workflow not work? Does it fail with an error or do you see some other unexpected result?
Hi Julia Bernikova ! Thank you for looking into this !
What I meant by “not working” is that when I change the “Estimation" field, the “Story points” field doesn't update. I have no failure message or unexpected result, it's like the workflow isn't even active (it is in this project).
With Workflow A, everything is going well, when I update “Story points”, “Estimation” updates automatically as expected.
Workflow B is to be used in a different project than Workflow A, could this be a factor ?
I'll share the code below.
Hi Marion Morazzani,
It seems that the workflow was first created in the visual constructor and then converted to JavaScript. I believe it used to be a sequence of the “IF” blocks, that's why it only converts the time estimate for a few predefined values (1h, 2h, 3h, 1d, 2d) and doesn't account for anything in between. So, I'd suggest starting from scratch for easier troubleshooting. Here's an example of a rule converting time estimation into story points:
The code is quite basic, but it should let you achieve the task. Feel free to change the conversion logic and let me know if any questions occur!
Hi Julia Bernikova thank you for taking the time to help !
Yes, the code I shared was converted from visual editor, as I am not skilled enough to use JS directly 😅
I'm managed to implement the workflow you share and it works perfectly ! Thank you so much !
I'll use it to improve my code reading/writing and try composing the next workflow directly in JS.
Thanks again !
Marion Morazzani,
I am happy to hear the workflow works, thanks for the update!
Just so you know, workflow conversion is a completely valid approach to getting more familiar with the JS code under the hood. So, please feel free to continue doing that as long as it makes composing workflows easier. My comment was purely about this particular case where correcting the converted workflow would be more laborious than starting fresh.
You can also check out our documentation for more real-life JS workflows: Use Cases for Workflows. And don't hesitate to reach out if any questions occur!