Home › Forums › Presentation › UI Events › Trigger a notification on button click
Tagged: trigger notification
- This topic has 2 replies, 2 voices, and was last updated 5 years, 3 months ago by Aditya Phatak.
-
AuthorPosts
-
-
September 16, 2019 at 3:26 am #12166Aditya PhatakParticipant
Hi,
We have a requirement to trigger a notification rule (In-app/Email) when a certain type of user clicks on a button. The usual approach would be to trigger a UI Event to set an attribute on the class which can be used in rules criteria to generate notifications.
However while I was searching through the model, I found some events listed in SysNotification class (changeSet and send) which needs the parameters: key, user, payload and seem to be doing the exact same work of triggering a push notification.
Not sure of how or if the class events can be utilized and whether this has been implemented anywhere currently.
Can someone please guide me through how to implement it? If it is not feasible, is the usual approach mentioned above suitable?
Regards,
Aditya Phatak.
0 -
September 16, 2019 at 12:05 pm #12186Atulan ZamanParticipant
Hi Aditya,
Notifications don’t have to be configured through rules. They can be created in the server for specific users, and they will automatically receive the notification. Unless the requirement has to be implemented through rules, you can simply a bind the button with an UIEvent and make a server invocation and create the notification instance in the model event. You can use the CUDNotification’createFactory API to achieve that. For example:
Java1234567891011121314151617181920212223242526272829<pre class="">#CUDNotification.createFactory(for instanceId instanceName functionalArea localizations . args): anyFactory to create a single instance of CUDNotificationArgumentsfor UserPerson The user that this CUDNotification is forinstanceId string The string representation of oid of the relatedObject that is triggering the creation of this CUDNotificationinstanceName String The class name of the related ObjectfunctionalArea NotificationFunctionalArea The subject area of this CUDNotificationlocalizations Collection of localization messages of the following form: (message (: localeName "en") (: message "test") (: emailSubject "Subject") (: emailBody "Test"))ArgsOptional arguments Currenlty supported optional arguments: 1. actionId - Specified the OID of the action that triggered this CUDNotification 2. associatedActions - A collection of strings representing the associatedActions that need are to be linked to this CUDNotification instance<pre class="lang:xhtml decode:true "><pre class="crayon-selected"><pre class="">(CUDNotification'createFactory(user-person)(oid->string (((ScheduleItem'read () () () () () ())'1)':oid))(ScheduleItem'UICOMPONENT_NAME)(NotificationFunctionalArea'get 'SCHED_ITEM)(collection(message (: locale "en")(: message "Test notification")))(: isRuleBased #f)(: createTime (now))(: associatedActions(collection(rules:AssociatedActionTypeEnum'MARK_AS_COMPLETE)(rules:AssociatedActionTypeEnum'FOLLOW_UP))))</pre>Thanks,
Atulan0 -
September 17, 2019 at 1:42 am #12196Aditya PhatakParticipant
Hi Atulan,
The drawback using the CUDNotification is that we cannot configure the criteria/recipients at runtime like we do from Rules. I was looking for a flexible option to just trigger the notification rule from UI Action if at all feasible.
Regards,
Aditya Phatak
0
-
-
AuthorPosts
- You must be logged in to reply to this topic.