When a user publishes a given Page Type, I am performing some business logic (creating a PDF file) How do I send an Information message back to the UI notifying the user that the PDF was genrated successfully.So...
private void EventsPublishedContent(object sender, ContentEventArgs e)
if (e.Content is MyPageType)
//Business Logic Here...
InformationMessage here <>< how do I send a message..
Using the IValidate interface you can code stuff and show as information to the user which might be a good option if the PDF creation is fast and stable:http://jondjones.com/learn-episerver-cms/episerver-developers-guide/common-web-page-component-tutorials/how-to-return-different-validation-warnings-to-content-editors-when-publishing-content-in-episerver
To avoid users having to wait a lot when publishing if the PDF generation is slow it's probably better to run a job and alert the user by notification instead.
Update: By adding this to my project
public IEnumerable<ValidationError> Validate(MyTypeinstance)
ErrorMessage = "A PDF for this page has been generated.",
PropertyName = "test",
Severity = ValidationErrorSeverity.Info,
ValidationType = ValidationErrorType.AttributeMatched
In the back office as soon as I change something I can see the notification message in the back office, but this is before the publish button is clicked. Is this the best you can do, in episerver?
You could consider hooking into the notifications framework. This would mean the message would appear as a new notification in the bell at the top right in the UI. The nice thing about this approach is that the PDF generation could happen async and the notification would appear as/when the PDF is ready.
More information here: https://world.episerver.com/documentation/developer-guides/CMS/using-notifications/