Automated Version Management 2.0 – An Update

[Updated]
I had to update this post a little bit, see below for the details, but the killer feature had to go 🙁
[/Updated]

Remeber that tool “Automated Version Management” that I published here and on Mibuso five months ago? It has just got an update: version 2.0.

First, a disclaimer: THIS IS PROVIDED AS IS, WITHOUT ANY WARRANTIES, AND YOU USE THIS AT YOUR OWN RESPONSIBILITY. All other disclaimers here on this site apply as well. Now that we are over with legal yadda-yadda, let’s get down to facts.

What’s new? A lot.

  1. Initialization: Before you can use the tool, you must call Initialize Version Management function, which makes a default version out of each object.
  2. Check In / Check Out functionality: Objects can’t be modified by any user, unless that user has first checked out the object. If an object is checked out, only the user who has checked it out can save it. Other users can’t save it. New objects can be created at any time, but for any consecutive changes, you must check out the object first. You must check objects out for deletions, as well as for restoring previous versions.
  3. Cancel Check Out: Object which has been checked out can be reverted to the last checked-in state by simply calling Cancel Check Out. Any saved changes will be rolled back.
  4. And a big fat cherry on top: For a true collaborative development, an extra feature is there – a user who has checked out an object can save it as many time as they want – it won’t affect other users until the object is checked in. For example, Johnny checks out Codeunit 80, and starts making changes. Any changes that Johnny does, will be visible only to him. If Jenny looks at Codeunit 80, she will se the latest checked in version. Only after Johnny checks in the Codeunit 80, Jenny will see the changes made by Johnny. Ok, this doesn’t work with tables – have to figure out how to handle tables the best possible way, but with other objects, it works ok.

[Update] Unfortunately, I had to drop this last feature, because it simply can’t be made to work with tables. Any table change subsequent to the initial table creation would simply not update the underlying SQL Server table object, so I had to change this and upload the updated version – it has everything, but this.[/Update]

Ok, for this last gimmick I had to do some ugly hacks to the database: rename the Object table to Object (NAV), then create a view called Object over the Object (NAV) table. This view selects the latest modified version for the user who checked the object out, and checked in version for all other users. There is a bunch of INSTEAD OF triggers over this view to make this possible. Now – I can’t tell whether this will work in 100% of situations, so before you decide to do anything with this – check it first, on an empty Cronus database. It worked for me, without any problems, on two different databases. NEVER EVER USE THIS IN ANY PRODUCTION ENVIRONMENT.

Of course, all functionality from previous versions, such as the possibility to restore a previous version, is still there. Also, thanks to suggestions from many users, the tool now correctly displays user name. I also had a suggestion to implement the Restore As functionality, but this would require some more tricks with SQL Server, it will come in a future version.

To install this tool, simply download the [Update]Version Management 2.01 file, rename it from .doc to .zip [/Update] (unfortunately, WordPress doesn’t allow me to upload anything else), it contains all the files embedded. Then first import the objects into NAV, then execute the SQL script in the context of the database which you want to have version managed.

If you have any questions, please feel free to ask them here, I’ll be happy to answer. Also, if you find any bugs, let me know!

Vjeko

Vjeko has been writing code for living since 1995, and he has shared his knowledge and experience in presentations, articles, blogs, and elsewhere since 2002. Hopelessly curious, passionate about technology, avid language learner no matter human or computer.

This Post Has 9 Comments

  1. Erik

    Well I’ve tried to download this document several times, but it seams that the files (both the fob and txt) are cut off. How big should the files be?

  2. Vjeko

    Erik: I’ve tried to download this document now, and I succeeded, and I could open the TXT file from it. I don’t know where the problem is, I will check it ASAP. Please have patience until I figure out how to best deploy this tool here on WordPress.

  3. Vjeko

    Erik: Ok, now it works – but you first need to rename the .doc file into .zip.

  4. Tomas

    Hi,

    I have downloaded doc file. Renamed it to zip. Extracted files. Imported fob files. When I try to execute SQL script I am getting error message:

    Msg 208, Level 16, State 6, Procedure Object Version System Info, Line 3
    Invalid object name ‘dbo.Object Version System Info’.
    Msg 208, Level 16, State 6, Procedure Object_OnDelete, Line 65535
    Invalid object name ‘dbo.Object_OnDelete’.
    Msg 208, Level 16, State 6, Procedure Object_SaveVersion, Line 65535
    Invalid object name ‘dbo.Object_SaveVersion’.

    What did I miss?

    Thanks.

  5. Vjeko

    Hi Tomas,

    Thanks for pointing this out – you are obviously the first one to actually download and try to put this to work! Sorry for this problem, I’ve obviously included the wrong SQL file.

    The problem with this SQL file is that it contains three ALTER statements, instead of CREATE statements. So, to make it work, simply do a replace-all: search for ALTER and replace it with CREATE, then execute the SQL script. It will make it work.

    Best regards,

    Vjeko

  6. njer

    Two question, is there a way for an administrator to check-in objects, and is there a way to un-install this tool?

    1. Vjekoslav Babic

      @njer: No to both of questions. A functionality for an administrator to check in objects is not a part of this, I might add it in the future, but I don’t know when and if. About the uninstall, it has to be done manually – basically, you need to remove the trigger from the Object table in SQL, and delete all the extra NAV objects that belong to this tool. I also might include that in a future version.

  7. Morten

    Hi Babic, just wanted to hear if you have a newer version running pages either on Nav 2013 R2 or Nav 2015 cheers

    1. Vjeko

      Hi Morten! I totally forgot about this little thing I made ages ago… Sorry, no, I don’t update this tool anymore, there are so many different tools now in the market that it made no sense for me to invest any time in this anymore.

Leave a Reply to Vjekoslav BabicCancel reply