This is not same as 'Salesforce API version'.

Objective: There is a VF page that renders as PDF which numerous users use. I would like to include in the footer my own running version number that is automatically generated (something like v1.0.1 or v2015.06.02.001 or anything). The version needs to update each time I modify the custom controller or deploy the code to a different environment or anything better if you may. It doesn't need to be sequential.

Purpose? To identify that two documents presented to me by different users belong to different 'versions' (source code) without looking through the actual content.

Is there an easy way to implement this?


So you can add a footer via a div as per Adding page header/footer into a VisualForce page rendered as PDF.

Then you could expose a property in the controller with the "version" details that is bound into the Visualforce page footer.

Since you want the versioning to be automatic and tied to the custom controller, you could derive something from the ApexClass SystemModstamp. LastModifiedDate and BodyCrc are other options that you might want to use.


Select Id, Name, LastModifiedDate, SystemModstamp 
from ApexClass 
where Name = 'MyControllerClassName'

You could hash several useful values together if you aren't to concerned about what the actual source values are.

I'd probably go with a combination of the ApexClass Id and SystemModstamp. It would be unique to each org and would show when the controller was updated.

| improve this answer | |

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.