Hey versioning experts,

Has anyone used Apex to construct a semantic version bumper?

Im looking to implement an Apex-driven "versioning" concept to a custom app, functioning somewhat similar to versioning forms/validations in SFDC Packaging, but specific to salesforce Records, not Packages.

The idea is that records would have semantic versions like packages but stored in a custom text field, "SemVersion__c".
The user would be allowed to increment it using semantic versioning standards so that version strings are comparable (major minor patch qualifier etc.) and always-incrementing

Thanks for the collaboration!

  • 3
    I haven't explored using it against Apex records, but the native Version class could be really useful here. It will give you a container for you major, minor, and patch numbers. Plus a compareTo(version) method. – Daniel Ballinger Nov 24 '20 at 21:49

One option would be to use the native Version class that Apex provides.

This will give you major, minor, and patch numbers.

Plus there is an existing compareTo(version) method.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.