Announcement notifications to all users of affected Accounts

Announcement notifications to all users of affected Accounts

 Overview 

The below document explains the steps needs to be configured for sending notifications to all users of accounts, using announcements.

How It works

* Create a Group email alias for each account, such that sending mail to this group email will notify all the users of that account.
* We will configure this group email alias as an additional field of Account inside the MSP application.

* Now when an announcement is raised with a set of affected accounts, The group email alias configured for these accounts will be notified individually with the content of the announcement.


Implementation

To achieve this requirement, we will be using the following functionalities in our product.

  1. DB trigger

  2. Global functions

  3. Callback Custom Functions

(I) DB Trigger configuration.

To configure DB trigger, add the following entries in the mentioned xml,  

1.Edit [MSP_HOME]\conf\OperationHandler.xml and add following entries
 <Module name="Announcement" table="Announcement" operation="C"/> 

2.Edit [MSP_HOME]\conf\Observers.xml and add the following entries
<Observer class="com.adventnet.mspdesk.service.ScriptObserver" modules="Announcement"/> 

3.Edit [MSP_HOME]\conf\ScriptObserver.xml and add following entries

 <Script module="Announcement" output="ANNOUNCEID" table="Announcement" command="announcement_notification.txt"/>


4.Create announcement_notification.txt under [MSP_HOME]\integration\custom_scripts\executor_files and place below content in it

 py triggernotification.py $id announcements


5.Create triggernotification.py under [MSP_HOME]\integration\custom_scripts and place below content in it.
Note: For Steps 1,2, 3,4 and 5 please refer the DB Trigger Configuration files as well as executor python file attached as a zip document(Place the following entries in the XML files as mentioned in the text document and place the python file and executor file as mentioned in the steps 4 and 5)

(II) Global functions

 

Configure the following global functions.

Function 1 

 

Function Name - Get Configuration

Return type - Map

API Name - getconfiguration

Function definition Code 

Note : Edit the url and techniciankey and additional field name in the above function

Function 2

 

Function Name - Get Entity Details

Return type - Map

API Name - getentity

Parameters

entityid=int

entity=string

Function definition Code 


Function 3

 

Function Name - Get notify emails for Accounts

Return type - String

API Name - getnotifyemailsforaccounts

Parameters -

account=Map

Function definition Code

Function 4

 

Function Name - Send Mail for Account additional field configured emails

Return type - void

API Name - sendmailforaccountemails

Parameters -

accountsjson=Map

messagecontent=String

subject=String

Function definition Code -


Note: For Global Functions 1,2,3 and 4 please refer the global function document attached as zip file and create the global functions as mentioned in the above screenshots

(III) Custom Callback functions

 

Once the above Global functions are defined, configure the Custom call back function as below.

Function Name - Send Mail to Accounts

Return type - void

API Name - sendemailtoaccountcallback

Publish - True

Parameters -

moduleid=int

module=String

Function definition Code -


Note: Copy the URL shown under "URL to execute this Custom Function" and configure the same in triggernotification.py

Note: For custom call back functions please refer the callbackfunctions document attached as zip and create callback function as mentioned in the above screenshot














                    New to ADSelfService Plus?