I have a piece of information I need to store on a specific page version, not necessarily a page.
My client has a set of several thousand highly-regulated procedures, managed in EPiServer. These procedures are updated several at a time, in batches. So, "Batch X" would represent the updating of several dozen procedures at one time. All changes in Batch X would be reviewed as a group.
When my client updates a procedure, they create a new version of the page. They need some way to specify that a particular version of a page is in a particular batch.
I figured I could store this with the page data as a property, but it gets a little complicated. Consider:
You see where this gets weird? The value isn't meant for the page itself, it's meant for the the specifc page version.
Now, I could go back to Version #2 and clear the batch number from that...or could I? If I save Version #2, I think that would create Version #4.
I thought about storing this in DDS. I would have tri-valued object -- Batch Number, Page ID, and Work ID. However, I don't want to have to build a special interface for it. I'd rather editors worked with this purely in Edit Mode.
One option: create the Batch Number as a property, then catch the PageSaving event. Read it out, update DDS, then clear the value. (I might have to do PagePublished, to get the Work ID, though. If so, I could go back and clear the property then save and ForceCurrentVersion.)
Any ideas on how to tackle this?
So everytime you publish (not save) you need to update the batch number? Is this something the editors need to see and manually update or should the system take care of it behind the scenes?
The batch number is non-derivable. It will need to be manually added by the editor.
I think the logic should work like this --
Say someone has Version #1 with a Batch Number of 413. If they edit that page and create Version #2 and do not change the Batch Number (it remains 413), then that Batch Number needs to be removed from Version #1 -- so it would transfer, effectively, to Version #2. But if they enter a new Batch Number for Version #2 (414, let's say), then that's fine -- 413 can stay on Version #1.
Put another way -- Batch Numbers need to be unique between versions. No two versions of a page can carry the same Batch Number.
So a page version can either have a unique batch id or none at all? Maybe hook into the save/publish event (using workflows or initializable module etc), store the pagereference (page id + work id) in DDS together with the batch id, then you have a property on the page that reads this data from DDS and displays the correct batch id for that version. You can also easily add logic for checking that the batch id is unique and update existing references.