AyaNova 7: AyaScript to set ALL client's "Send client notifications" to False

The following is instructions how to use AyaScript to create a script that when run, will set all clients “Send client notifications” to False

Please read through all instructions first.

  1. Have all users out and and make a backup of your AyaNova database. In the event of a problem, you can restore from backup.

  2. Backup your database depending on what configuration your AyaNova is. For example - if your AyaNova database has been installed taking the defaults for stand-alone use you would follow http://www.ayanova.com/AyaNova7webHelp/if_using_the_stand_alone_singl.htm If your AyaNova database has been configured for network use with SQL than you would follow http://www.ayanova.com/AyaNova7webHelp/if_using_the_network_sql_expre.htm etc

3.The web page http://api.ayanova.com/AyaScript/index.htm contains an explanation of use of AyaScript

  1. Confirm your AyaNova is the latest version by viewing Help -> About AyaNova (as of date of this posting, latest version is 7.2.0.0 Hotfix 1)

  2. Download the same version AyaScript setup file from http://www.ayanova.com/Download.htm

  3. Install taking the defaults on your computer where your AyaNova program is already installed - it will be installed to your existing AyaNova folder and will load with your existing AyaNova

  4. Run AyaNova

  5. Log in as the AyaNova Administrator

  6. From the Plugins menu at the very top, drop and select the AyaScript plugin -> which will display the AyaScript editor and existing sample scripts already entered. Select AyaScript Editor

  7. Copy all of the script between the two ***************** lines below

  8. Paste into the AyaScript Editor

  9. Exit out of the AyaScript Editor and save

  10. From the Plugin menu, again select AyaScript, which will display the AyaScript editor and existing sample scripts already entered, plus now also Un-notify all clients

  11. Select Un-notify all clients - it will internally run the script, setting all clients “Send client notifications” to False. And will notify you when done.

  12. When done, check to confirm all clients have their “Send client notifications” set to False.

  13. If you encounter an issue, restore from before you proceeded.


//Script created: 5/4/2012 10:17:50 AM
//Name: Un-notify all clients
//ShowInMenuFor: Everywhere
//HandlesAyaNovaTypes: Nothing

public static void AyaScriptMain(bool IsList, RootObjectTypes objectType, Object ayaNovaObject, List<Guid> objectIDList)
{
ClientPickList cpl = ClientPickList.GetList(false);
int ClientsUnNotified=0;
foreach (ClientPickList.ClientPickListInfo i in cpl)
{
Client c = Client.GetItem(i.ID);
if(c.SendNotifications)
{
ClientsUnNotified++;
c.SendNotifications = false;
c.Save();
}

    }

    MessageBox.Show(ClientsUnNotified.ToString() + " Clients had notification turned on and were switched off.

All done!");

}