With my AF server and PI notifications, we have a lot of notifications running, and a lot that are automatically created from templates.

AF automatically names them "Notification37" or something, which I find to not be particularly helpful.

I wrote a small app that goes through the notifications, and renames them based on their target, parent, and template name (you can of course change how exactly the renaming works for you

 

it is a little C# console app

I put it up on my github as well GitHub - madmaxlax/OSIsoftAFNotificationsRename: A small app that goes through your automatically-created notifications …

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PISDK;
using OSIsoft.AF;
using OSIsoft.AF.Asset;
using System.Configuration;
using System.Diagnostics;
using System.IO;


namespace NotificationsRename
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Starting");
  //connect to AF
            string pisysname = ConfigurationSettings.AppSettings["PISystemName"];
            string Afdbname = ConfigurationSettings.AppSettings["afdb"];
            Console.WriteLine("Connecting to AF DB " + Afdbname + " on " + pisysname);
            PISystem PISys = new PISystems()[pisysname];
            AFDatabase AFDb = PISys.Databases[Afdbname];
            Console.WriteLine("Connected to AF DB " + Afdbname + " on " + pisysname);
  //refresh and check in, just in case
            AFDb.ApplyChanges();
            AFDb.CheckIn();
            AFDb.Refresh();

  //start
            Console.WriteLine("Ready to begin? Press any key");
            Console.ReadKey();


            foreach(OSIsoft.AF.Notification.AFNotification curr in AFDb.Notifications)
            {
  //only change name of notifications coming from templates (which have a name)
                if (! (curr.Template == null) )
                {
  //this is the format I chose for the naming: [Template name] [parent name]-[element name]
  string newname = curr.Template.Name + " " + ((OSIsoft.AF.Asset.AFElement)(curr.Target)).Parent.Name + "-" + curr.Target.ToString();
                    Console.WriteLine("Renaming this notification: " + curr.Name + " to: "+ newname);
                    //rename the notification
                    try
                    {
                        curr.Name = newname;
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("*Unable to rename: " + e.Message);
                    }
                }
                Console.WriteLine("Name: " + curr.Name);
            }
            


            Console.WriteLine("Checking in changes...");
            AFDb.ApplyChanges();
            AFDb.CheckIn();
            AFDb.Refresh();
            Console.WriteLine("Press enter to quit");
            Console.ReadLine();


        }
    }
}