Wednesday, March 17, 2010

Customized Version Control - Binary

As of at least 7.8 you can now implement your own forms of version control for custom objects. Bookshelf provides some specifications for BC User properties in the Developer's Reference, User Properties, Business Component User Properties:

Revision Condition
Revision Copy
Revision Field

Using these with the Vanilla method, Revise, allows you to achieve funcitonality similar to what you see in a quote. To implement, create a custom minibutton on an applet and set the method to be 'Revise'.

On the BC the applet is based on, create a User Property

name = Revision Field
value = Version

Where version is the name of a BC field storing a sequence. Create a sequence BC and link for the source BC.

Revision Condition is an optional user propery that allows to to disable the Revise button under certain conditions. Here is an example if you only wanted the button enabled when the Status = 'Active'. You can have as many of these as you like and the system will interpret an AND condition between each of them.

Name = Revision Condition 1
Value = "Status", "Active"

Pressing the Revise button will make the current record Read Only, and create an editable copy. The copy is immediately 'Active' and the revised original is immediately old. This functionality can be combined with the user property Active Field to make control the editability of these records. To do that, create or identify a flag field on the BC; I'll use Edit Flag as my example. Create a new BC user property:

Name = Active Field
Value = Edit Flag

Now when you create the revision, the new Active copy is editable and the old copy is read only, or archived.

This is a binary way to look at archiving which may be useful in many instances (Quotes obviously), but there are other times when a tertiary state is needed. That is you may want to tweek the settings of the new version before activating it, leaving the previous version active until ready to activate the revision. That will be the subject of another post.

No comments:

Post a Comment