Is there anyway to modify one-timed scheduled event using VAIL procedure?

Greetings.

I would like to create a one-timed scheduled event upon user action. From the client app, the user provides an appointment time, this action will then trigger a rule to create a scheduled event. The procedure code is as follow:

appt = AppointDatetime.minusMillis(1 hour)
PUBLISH { evtTitle: evtTitle } TO TOPIC “/oneTimedEvent/alertUser” SCHEDULE {name: evtTitle , occursAt: appt}

However, when the appointment time of the same event (identified by evtTitle) changed, the one-timed event needs to be updated. Execute the same procedure twice returns the error message (shown in the attached figure)

Is there anyway to modify the schedule event using VAIL code? Or any other methods to handle this use case (Set appointment reminder after a user set appointment DateTime in client app)?

Thanks in advance.

 

 

Attachments:
You must be logged in to view attached files.
Posted: October 16, 2020 at 9:24 am
Replies: 2
Oct 16, 2020
Posted by Ken

Hello,

As you have discovered you cannot alter a one-time scheduled event.  However, you can delete it and then create a new one.  Will the following work for you?

PUBLISH { name: “granite” } TO TOPIC “/myTopic/x” SCHEDULE {name: “graniteEvent”, interval: 1 minute}

// After some time you find out it needs to be reschedule so you do this:
DELETE system.scheduledevents WHERE name == “graniteEvent”
PUBLISH { name: “granite” } TO TOPIC “/myTopic/x” SCHEDULE {name: “graniteEvent”, interval: 10 minute}

Instead of “interval” you will probably want to use “occursAt”.

Will something like that work?

Oct 20, 2020
Posted by Eng Kee Tan

It works! Thanks a lot 😀

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
© Vantiq 2024 All rights reserved  •  Vantiq Corporation’s Privacy Policy and Cookie Policy