Try our conversational search powered by Generative AI!

Message field for Episerver CMS 11.x

Vote:
 

Do Episerver provide a field or a notification where you can send message to editors? Most CMS systems have some sort of message handling system. For instance if there is a plugin installed but it is not registered, then you could post a message to the editor in edit mode, to either go to settings to register or configure or similar.

#192317
May 15, 2018 11:11
Vote:
 

Yes, there's a notification areas in the upper right corner of Episerver that allows notifications to the user. Out of the box this is used for areas such as content approval notifications however you can easily hook in to this for custom notififcations

https://world.episerver.com/documentation/developer-guides/CMS/using-notifications/

#192326
May 15, 2018 12:18
Vote:
 

Hi Scott,

Thank you. Yes it can be used but it does not seem like you can remove messages again.

An editor logs in, and gets a notification that something needs to be done (type in license key, configure etc..) Then when that is done and you return the page, the message persist. I have read that it truncates every night, but is there a programatically way of removing messages?

#192534
May 18, 2018 10:22
Vote:
 

I don't believe so, it's just a notification dispatcher and it's up to the user to click the message so it's marked as read. I've had a look at the underlying code and there is a delete method in the INotificationRepository but the implementation class DefaultNotificationRepository is marked as Internal so it won't work if you inject it and it would be difficult to create your own implemtation as the DefaultNotificationRepository uses NotificationMessagesDB which is also internal.

However if you really need this the code for the direct database access in the NotificationMessagesDB is

    internal async Task DeleteAsync(IEnumerable<int> messageIds)
    {
      IAsyncDatabaseExecutor db = this.Database;
      await db.ExecuteTransactionAsync((Func<Task>) (async () =>
      {
        DbCommand cmd = db.CreateCommand();
        try
        {
          cmd.CommandText = "netNotificationMessagesDelete";
          cmd.CommandType = CommandType.StoredProcedure;
          cmd.Parameters.AddIntListParameter("@MessageIDs", messageIds);
          int num = await cmd.ExecuteNonQueryAsync().ConfigureAwait(false);
        }
        finally
        {
          if (cmd != null)
            cmd.Dispose();
        }
        cmd = (DbCommand) null;
      })).ConfigureAwait(false);
    }

So you could call this stored procedure yourself with the list of IDs pretty easily.

#192543
May 18, 2018 10:37
Vote:
 

Thank you Scott.

Then it is close to useless in the sense we are looking for.

I will mark your reply as answer.

#192554
May 18, 2018 12:45
Vote:
 
<p>Thanks, not knowing your exact requirements you could use the Tasks area.&nbsp;<a href="/documentation/developer-guides/CMS/user-interface/extending-the-tasks-pane-with-custom-queries/">https://world.episerver.com/documentation/developer-guides/CMS/user-interface/extending-the-tasks-pane-with-custom-queries/</a>&nbsp;This allows you to create actionable tasks that would appear for the user (such as the exisitng approval steps). You can create a group and a set of tasks and these are linked to a query that loads any data you desire. You could then put your "notifications" in the Dynamic Data Store which provides full Crud support and handle them as you see fit. I'm not sure if this meets your needs but it's worth mentioning as it's supposed to be used for items that can be removed or change state.</p>
#192555
May 18, 2018 12:50
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.