Skip to Content
0

B1 SDK: Creating Alerts Dynamically for Alerts Management

Jul 13, 2017 at 06:18 PM

53

avatar image

I want to know if it possible to create saved alerts in the SDK and attach it to query for Alerts Management? The reason for this is I have a customer I need to setup multiple alerts for multiple databases. It would take a lot of time setting this all up in the B1 Client. I figure it would be quicker if I used the SDK to archive this task so I can have it create the same queries for all database and the reference the alert I need for each query.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
DIEGO LOTHER Jul 13, 2017 at 08:44 PM
0

Hi Willian,

Yes, it is possible.

You should use the object UserQueries for create your saved queries and then use the service AlertManagementService for create alerts.

For create alerts there is a sample in SDK help:

Add a user alert

'get alert
Dim oAlertManagement As AlertManagement
Dim oAlertManagementParams As AlertManagementParams
Dim oAlertManagementRecipients As AlertManagementRecipients
Dim oAlertRecipient As AlertManagementRecipient

'Assuming that oAlertManagementService is already defined!
'Get alert
oAlertManagement = oAlertManagementService.GetDataInterface(AlertManagementServiceDataInterfaces.atsdiAlertManagement)

'set alert name
oAlertManagement.Name = Alert1

'set query
oAlertManagement.QueryID = 34

'activate the alert
oAlertManagement.Active = BoYesNoEnum.tYES

'set priority
oAlertManagement .Priority = AlertManagementPriorityEnum.atp_High

'Set the Frequency
oAlertManagement .FrequencyInterval = 1

' set the Frequency type to hours
oAlertManagement.FrequencyType = AlertManagementFrequencyType.atfi_Hours

'get Recipients collection
oAlertManagementRecipients = oAlertManagement.AlertManagementRecipients

'add recipient
oAlertRecipient = oAlertManagementRecipients.Add()

'set recipient code(manager=1)
oAlertRecipient.UserCode = 1

'set internal message
oAlertRecipient.SendInternal = BoYesNoEnum.tYES

'add alert
oAlertManagementParams = oAlertManagementService.AddAlertManagement (oAlertManagement )

The parameter QueryId should receive the id of your object UserQueries.

Hope it helps.

Kind Regards,

Diego Lother

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Thanks this is perfect.

0