This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Server Time - Workflow Based Notifications Send Time

Former Member
Former Member
Good day Community,

We have a unique scenario with a clients workflows and thought it might be a good idea to plug into the community to see if anyone has solved this before or has a starter point for the script that we may require.  I'd hope we aren't the first to run into this.

There are two parts to this scenario. Firstly the server has a set time for Daily Digest emails of 9:00 AM.  This also impacts any notification rules, built in the Desktop Client, one that use a Date value within the Define Filter, withholding them until 9:00 AM.  This is perfect, sending these out during the clients business hours.

We have also been building various workflows for this client and have noticed that on one workflow which utilizes the DayFrom() function, with a Date Property. That the workflows built in notifications, the ones on certain Events are triggering between 12:00 AM and 01:15 AM.  This makes sense as the server clocks kicks over to the next day, and the property matches the Define Filter conditions of the trigger, the one set before the workflow State containing the notification settings.  Unlike the Notification Rules, these do not appear to be governed by the Digest message time setting in the Admin Console thus they are sent out immediately once matching.

Could a script in the State Transition trigger resolve this?

Or should we script a Precondition on the State with the notification Action?

One concern we have is that if its a Precondition, would it sit on the server until the specified time frame, or would it be prompting the server constantly to complete that action?  Wouldn't want to bog the server down unnecessarily.

Please let me know if you have any suggestions or thoughts regarding this scenario.

Thanks
  • Can you consider configuring the notifications of that workflow via the notifications feature and not via the workflow feature?

    So the workflow would not send the notification when the DaysFrom condition is met (it can still change the state) but you would create a separate notification rule with the same DaysFrom criteria?

    Mika
  • Former Member
    Former Member
    We would go that route but wanted to use a custom message in the email, which is easy to setup in the workflow. To do that on the Notification Rule would require editing the servers notification template file. As I understand it that would mean that the default format would be setup across all the vaults on the server (and I cannot recall if a custom message can be made for a specific rule). If we can do a unique email for the rule then we will definitely try your suggestion.
  • Former Member
    Former Member
    Our latest idea for this is along the lines of trying to leverage a Time or Timestamp property, likely one hidden away from the users. Has anyone managed something like that? where at the chosen time 'property', that the server goes ok, time to send the notification, 8:00 AM = 8:00 AM kind of logic.

    For this we thought that Created would be a good starting point, since the clients would be creating these during their business hours, the system would see 2:00 PM as the creation time and then the Time/Timestamp trigger would push the workflow to the notification stage once the server matched.

    One of our troubles is Created is treated as a date property with those operators and kind of disregards the fact that they are merged (Date & Time).

    Unfortunately thought this logic, the server would likely see Time=Time immediately because once created they would immediately be equal as the property would be a flat time.

  • Is there a sleep function that you could utilise?
  • Former Member
    Former Member
    Hello All

    From what I've tested and used I haven't been able to get a system in place that will send notifications from a workflow at a certain time. I've only managed to delay the send time to be after a certain hour of the day. People were getting annoyed at getting emails at 1am in the morning. Below is the code that I have on an automatic state transition:

    Option Explicit

    Dim sStartDate
    sStartDate = PropertyValues.SearchForProperty( 1247 ).TypedValue.DisplayValue
    Dim sEmailTriggerTime
    sEmailTriggerTime = "15:00:00"
    Dim AgendaEmailSent
    AgendaEmailSent = PropertyValues.SearchForProperty( 1629 ).TypedValue.DisplayValue

    'If the difference between now and the start date is = 1 day and the difference between now and 3pm is
    If (DateDiff("d", Now , sStartDate) = 1) And (DateDiff("n", Time , sEmailTriggerTime )
    AllowStateTransition = True

    Else
    AllowStateTransition = False
    End If


    I've got some extra conditions in there that are particular to my situation but the main one is:

    (DateDiff("n", Time , sEmailTriggerTime ) 


    In this case the state transition happens some time after 3pm. It's not real specific but I've found that is generally happens within 45 minutes.

    Hope this helps.
  • Former Member
    Former Member
    Out of curiosity what are those two properties (1247 & 1629)? Are they additional date values on that metadata card?

    From our talks with M-Files it appears that workflows will trigger some random(ish) time between the start of the hour and the end of it. Its not really able to be refined down to a specific minute of that hour, that's likely why your seeing it within 45 minutes of 15:00.

    Thanks for posting that, this is a huge help!
  • Former Member
    Former Member
    Hello Cplant

    Property 1247 is the date that the event is happening so I'm sending out a notification the day before.

    Property 1629 is a check that the notification has been sent and at first is set to false but is changed to true once the notification has been sent. Stops a continuous loop of emails being sent.