Developer FAQ
In our website we have several user roles. Two of these roles are a content editor and a content end editor. The content editor is allowed to send a page for approval. The content end editor will check any page waiting for approval and eventually publish the page or send the page back to the content editor (Send To Draft).
What we would like to do is to extend the workflow so that when, for example, the content editor sends a page for approval, we send an email to the content end editor to notify him or her that there is a page waiting for approval.
How can we do this in C1?
Answer:
You can ‘subscribe’ to page changes (like a status change) using our “data event system”. This is a fairly undocumented feature, but this FAQ could get you going:
How to attach events to Composite C1 Data Stores?
You can subscribe to add, edit and update events on page data (which has type Composite.Data.Types.IPage). If you hook on to the ‘before data is changed’ event and query for the ‘old’ status, you can react on this information (old vs. new status).
To ensure that you are always attached to the data events, consider using this feature:
ApplicationStartupAttribute enables code execution on C1 application startup
You should be able to locate information about the user logged in by using the static class Composite.Seciruty.UserValidationFacade
.
You are left with the task of implementing the ‘logic’, but you should have fairly free hands implementing this. Consider including the (administrative) URL of the page in the e-mail. This would enable the content end editor to copy/paste the URL into the C1 console's browser address bar and instantly get to the page in question. This link could also work for quick previews.