Message Boards
Problem with notifications
Juan Pereyra, modified 3 Years ago.
Problem with notifications
New Member Posts: 8 Join Date: 7/13/20 Recent Posts
Hi there, Juan here!
I'm working with Liferay 7.3.3 and triying to send some notifications from a button in an action command.
This is my code:
But yet not having a notification in any place.
What I'm doing wrong here?
Thanks in advance!
I'm working with Liferay 7.3.3 and triying to send some notifications from a button in an action command.
This is my code:
private void sendNotification(){
JSONObject notificationEventJSONObject = JSONFactoryUtil.[i]createJSONObject[/i]();
notificationEventJSONObject.put("workflowTaskId", "123");
notificationEventJSONObject.put("notificationMessage", "This is the message");
notificationEventJSONObject.put("userId",20131);
NotificationEvent notificationEvent = NotificationEventFactoryUtil.[i]createNotificationEvent[/i](System.[i]currentTimeMillis[/i](), "Advice", notificationEventJSONObject);
try {
UserNotificationEventLocalServiceUtil.[i]addUserNotificationEvent[/i](20131, notificationEvent);
} catch (PortalException | SystemException e) {
e.printStackTrace();
}
catch(Exception e){
e.printStackTrace();
}
}
The userId exists. The method is called and I have no errors from the catchs.But yet not having a notification in any place.
What I'm doing wrong here?
Thanks in advance!