Hi
I was wondering if it is possible to define a automatic state change on a workflow based on a date, that has been calculated using an object's date property.
Regards
Yaney
'Make workflow pause x minutes before moving on
'Will only work on new objects because it compares Created time to present time, consider using LastModified (21) if relevant.
'Delay will be minimum the specified x minutes. Can be up to 60 + x minutes depending on when M-Files server checks the conditions.
'Script to be placed in Transition Trigger
'2019.07.04 Karl Lausten
Option Explicit
Dim dCreated : dCreated = PropertyValues.SearchForProperty(20).TypedValue.GetValueAsTimeStamp().UtcToLocalTime().GetValue()
'Desired delay in minutes:
Dim iDelay : iDelay = 5
Dim dGoAhead : dGoAhead = DateAdd("n",iDelay,dCreated)
'test time settings to verify the setup.
'err.raise mfscriptcancel, "dCreated (UTC converted to local time):" & dCreated & ", dGoAhead: " & dGoAhead & ", now (local time):" & now
if now > dGoAhead then
AllowStateTransition = True
end if
'Make workflow pause x minutes before moving on
'Will only work on new objects because it compares Created time to present time, consider using LastModified (21) if relevant.
'Delay will be minimum the specified x minutes. Can be up to 60 + x minutes depending on when M-Files server checks the conditions.
'Script to be placed in Transition Trigger
'2019.07.04 Karl Lausten
Option Explicit
Dim dCreated : dCreated = PropertyValues.SearchForProperty(20).TypedValue.GetValueAsTimeStamp().UtcToLocalTime().GetValue()
'Desired delay in minutes:
Dim iDelay : iDelay = 5
Dim dGoAhead : dGoAhead = DateAdd("n",iDelay,dCreated)
'test time settings to verify the setup.
'err.raise mfscriptcancel, "dCreated (UTC converted to local time):" & dCreated & ", dGoAhead: " & dGoAhead & ", now (local time):" & now
if now > dGoAhead then
AllowStateTransition = True
end if