YouTrack js query (by schedule) doesn't work

39 views Asked by At

I have js code, written by YouTrack API, for calling guard function, but anytime guard function not been called (I see that no console.log was called.) by cron schedule.

Here is rule:

exports.rule = entities.Issue.onSchedule({
  // TODO: give the rule a human-readable title
  title: 'Review-reminder',
  // TODO: define which issues are processed
  search: "State: {Review}",
  // TODO: set the schedule
  // For format details refer to http://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/crontrigger.html
  cron: '0 0 9 ? * MON-FRI',
  // TODO: to mute notifications for changes that are applied by this rule, set to true
  muteUpdateNotifications: false,
  guard: (ctx) => {
    // TODO: specify the conditions for executing the rule
    const issue = ctx.issue;
    //var expired = issue.updated < Date.now() - 24 * 60 * 60 * 1000;  // after 1 day
    //var expired = issue.updated < Date.now() - 60 * 60 * 1000;  // after 1 hour
    var expired = issue.updated < Date.now() - 30 * 60 * 1000;  // after 30 min
    console.log('worked');

    return expired;
  },

What can be problem here? I have State Review on my board. I have tried to debug my problem by changing cron pattern.

0

There are 0 answers