Rollback Object to some previous version?


I can roll back objects from condition search but I'd like modify current document in workflow, but it says that code is running or similar. How to modify this to run on workflow for current object? Reason why conditions is not an option is the number of objects to modify -> Timeouts

dim DocID, DocVer, VersionNum

Set DocID = Objver.objid
DocVer = Objver.Version
VersionNum = DocVer - 2

Dim CurVersion : Set CurVersion = Vault.ObjectOperations.GetLatestObjVer( DocID, True, True)

Vault.ObjectOperations.Checkout( DocID )

Vault.ObjectOperations.Rollback DocID, VersionNum

Vault.ObjectOperations.CheckIn( DocID )


Parents Reply Children
  • I've tried all I can think of.

    If the code is like that

    1 Option Explicit
    2 dim DocID, DocVer, VersionNum
    4 Set DocID = Objver.objid
    5 DocVer = Objver.Version
    6 VersionNum = DocVer - 2
    8 Dim CurVersion : Set CurVersion = Vault.ObjectOperations.GetLatestObjVer( DocID, True, True)
    10 Vault.ObjectOperations.CheckIn( CurVersion )
    11 Vault.ObjectOperations.Rollback CurVersion, VersionNum

    It gives error on line 11. "Toiminto ei ole sallittu. Komentosarjaa suoritetaan kohteelle '1222384'".

    If I comment out line 10 the error is like "Object is already Checked out"

  • I would be surprised if there's a way to do this within a synchronous process, such as an event handler or state action.  Rolling back the object creates a new version, but the system hasn't finished processing the previous version, so it'll fail.

    With the VAF and some sort of asynchronous process, yes, as you could fire the update after the current version has been checked in.  But not whilst it's being modified.

  • So impossible case again. I solved it by doing conditons that finds only few at a time. Then automatic transition that runs it for every document with on error resume 'cos it could find itself that would fail.