Configure your Environment and Parameters

In order to send and receive correctly the notifications, there are some configurations that you need to make.

Web Notifications Requirements

In order to receive the web notifications, you need to fulfil the requirements detailed in GeneXus Web Notifications Requirements

Also, your website has to be secure (https) if you want to receive the Desktop Notifications when running the application without localhost. So, for prototyping, you will be able to test the desktop notifications without it.

When you configure the IIS of the application in a production environment, you will need to enlarge the value of the property uploadReadAheadSize of the site that contains your application. In order to do this, you open the IIS Manager, click in the site and select the option 'Configuration Editor':

NotificationsIISConfiguration1

Then, you change the value of the property:

NotificationsIISConfigurationProperty

Mail Configurations

In order to send and receive the notifications by Email, you need to configure the SMTP data and Mail Sender data in the procedure 'WWP_GetParameter':

SMTPData001

SMTPData002

As you can visualize, there is an example of the configurations needed in case you will configure a Gmail account. If not, you just change all the values of the predefined parameters to what is needed.

SMS Configurations

In order to send and receive notifications by SMS, you need to configure the SMS data from a Sinch account, and set the values in the procedure 'WWP_GetParameter':

SMSConfiguration

You can create a Sinch account by logging into 'Messaging and Conversations' section, and get the SMS test data to set it in the parameters:

SinchSMSConfiguration

 

Notification Base URL Configuration

As it is mentioned in the comment of the parameter, the Base URL is used to insert the link in the Email and SMS to the notification. It is working in your default KB because the sending of the pending notifications is made by the website each time a notification is triggered. But if you trigger the notification with a scheduled process, this parameter should be set with a fixed value.

Sending the Notifications

When you call the procedure WWP_SendNotification (manually or when the code is automatically added), WorkWithPlus for Web creates with the status 'Pending' all the notifications that need to be sent. And there is another procedure named 'WWP_SendPendingNotifications' that reads all the SMS, Email, and desktop notifications that are with the status 'Pending' and sends it to the users.

This procedure is being called (in an asynchronous way) in the procedure 'WWP_SendNotification' when its parameter DoCommit is true. WorkWithPlus for Web added this so that you can make tests while you are developing your application.

But we recommend that you follow the steps below:

  1. Remove the line that calls 'WWP_SendPendingNotifications' it in the procedure 'WWP_SendNotification'

    PendingNotifications001
     
  2. Create a scheduled task in your operating system that calls this procedure (changing its property 'Main' to true and 'Call protocol' to 'Command line') and set a frequency to the task (every minute, every hour, etc., depending on the system requirements).

    PendingNotifications002
     
  3. The only place that you could want to have the notification to be sent right at the moment you create it is when you send discussion messages. This would have to be done in the procedure WWP_NotifyDiscussionMessage

    PendingNotifications003

Send Notifications using 'In Line' Edition

When you use the feature of editing a record directly in the list (the property 'In Line' of the Standard Actions Insert, Update and Delete), the notification will be created but will not be triggered in that moment , as the modification is made using a Business Component.

So, if you have followed the steps above, it will work properly in the same way as when using a transaction form (because the scheduled process will trigger the pending notifications each X minutes).

But if you haven't followed the steps, in order to get the notification at the moment of making the change in the record, you need to add the following line at the bottom of the automatically generated event ''EditableGridConfirm' you need to add the following code: 

If &<TransactionName>EditableGrid.Success()
     WWP_SendPendingNotifications.Submit("")
Endif