Time Tracking in workflow - action after workitem added

Answered

Hello,

I need help with creating a workflow that calls an URL endpoint whenever the workitem is added/edited in issue. We need to integrate YouTrack with our reporting system.

1
3 comments

Hello Josef, we're ready to help, could you please paste the code that you currently have? What doesn't work there?

0

Ok, I have:

if(!ctx.issue.workItems.isEmpty()) {

 //do something
}

But this is triggered everytime there is at least one workitem. BUT, I want to handle situation, when work item is added. I also considered state-machite rules but it seems that Time Spent field is special, because it cannot be changed directly (only through adding workitems)...

Could you please give me a hit, how can I handle the change of total spent time of an issue? Thank you.

0
Avatar
Permanently deleted user

Hello Josef,

You are right, 'Spent Time' is a special field: when you turn the time tracking on, this field is updated automatically. So, you may use the following check:

`if (ctx.issue.fields.isChanged(ctx.ST))`,

where `ctx.ST` is defined in requirements section:

`ST: {

  type: entities.Field.periodType,

  name: 'Spent Time'

}`

0

Please sign in to leave a comment.