Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jeavon Leopold 3072 posts 13628 karma points MVP 10x admin c-trib
    Oct 08, 2013 @ 11:55
    Jeavon Leopold
    0

    v6 API Content Service doesn't trigger Umbraco notifications?

    Hello,

    I am using the v6 content service to create new nodes from a front end application via a WebApi controller. Everything is good except that the content service doesn't appear to trigger the Umbraco notifications setup in the UI to execute. So questions are:

    1. Can it?
    2. Should it?
    3. Is it possible to manually trigger the notifications programmatically in C#?

    Thanks,

    Jeavon

  • Morten Christensen 596 posts 2773 karma points admin hq c-trib
    Oct 08, 2013 @ 12:59
    Morten Christensen
    0

    Which notifications are we talking about? When you say "Umbraco notifications setup in the UI to execute" I'm not sure if you mean the speech bubles in the backoffice or something else?

    - Morten

     

     

     

  • Jeavon Leopold 3072 posts 13628 karma points MVP 10x admin c-trib
    Oct 08, 2013 @ 13:06
    Jeavon Leopold
    0

    Hi Morten,

    I mean if you right click on a node and select "Notifications" you can setup email alerts for various events so you are alerted when those events occur.

    Jeavon

  • Morten Christensen 596 posts 2773 karma points admin hq c-trib
    Oct 08, 2013 @ 16:00
    Morten Christensen
    1

    No, those types of notifications will only occur when using the backoffice or the legacy API (well the parts of the legacy API which would call 'umbraco.BusinessLogic.Actions.Action.RunActionHandlers' - New Doc, Publish, Delete, etc.). This probably hasn't been noted as a breaking change in v6 on the tracker, but it should have been as everything that has to do with the legacy Actions/ActionHandlers is considered legacy and not something that we can support (directly) in the new API (it wouldn't make sense).

    But it should be fairly simple to call the notification stuff from your own code, so you can have notifications sent when ever something specific occurs.

    What you do is to call: umbraco.cms.businesslogic.workflow.Notification.GetNotifications(CMSNode Node, User user, IAction Action) ... found in the cms.dll
    Or you call: umbraco.BusinessLogic.Actions.Action.RunActionHandlers(Document d, IAction action) ... the main caveat of course being that you'll need to pass it a legacy Document object.

    Example:

    umbraco.BusinessLogic.Actions.Action.RunActionHandlers(legacyDoc, ActionDelete.Instance);

    for something that is being deleted.

    Hope this helps,

    Morten

  • Jeavon Leopold 3072 posts 13628 karma points MVP 10x admin c-trib
    Oct 08, 2013 @ 18:15
    Jeavon Leopold
    0

    Hi Morten,

    I think these approaches would have worked, however I have no HttpContext (WebApi async task), so the sendNotifications method is throwing a exception as it requires the HttpContext which is quite probably one of the reasons the Content Service can't trigger notifications in the first place!

    I will think of something else :-)

    Thanks,

    Jeavon

  • Morten Christensen 596 posts 2773 karma points admin hq c-trib
    Oct 08, 2013 @ 18:29
    Morten Christensen
    0

    The ContentService alone will never trigger the ActionHandlers which run the notifications.

    / Morten

Please Sign in or register to post replies

Write your reply to:

Draft