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

Batch to recalculate a property everyday

Former Member
Former Member

Hi every one,

i'm totaly new with M-Files and I'd like to know if there is a way to automaticaly recalculate the property of an object every day.

Thanks

Parents
  • You could place the object in a workflow that automatically cycles on a daily basis.
    M-Files workflows will not allow a loop directly in automatic transitions, but you can insert a script that will change the workflow state back to a previous state.
    State 1 -> automatic transition after one day -> State 2, action script that changes the workflow state back to State 1.
    The script below assumes you have Aliases on your workflow states. If not, you can look up the ID manually and insert that in the script in stead.

    Option Explicit
    dim iWFState : iWFState = vault.WorkflowOperations.GetWorkflowStateIDByAlias("")
    Dim oPropVal: Set oPropVal = CreateObject("MFilesAPI.PropertyValue")
    oPropVal.PropertyDef = 39 ' Workflow states build-in property
    oPropVal.TypedValue.SetValue MFDatatypeLookup, iWFState
    Vault.ObjectPropertyOperations.SetProperty ObjVer, oPropVal
  • Is it possible to modify the script so it goes back to the previous state without hardcoding it?

  • That should be possible. You would have to get the version number of the previous version, get the propertyvalues from that version and then get the value of the workflow state. I do not have a script on hand for that nor do I have the time to create one at the moment.

Reply Children
No Data