cancel
Showing results for 
Search instead for 
Did you mean: 

B1 SDK: Creating Alerts Dynamically for Alerts Management

former_member272979
Participant
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

former_member185682
Active Contributor
0 Kudos

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

former_member272979
Participant
0 Kudos

Thanks this is perfect.

Answers (0)