Question
· Apr 12, 2019

How to trigger messages on Personal Community login?

I'm looking for the most straightforward way to trigger a custom Ensemble message when a patient logs into the Personal Community patient portal. The use case is that when the patient logs in, we want to query an external email database for any new messages the patient has and import them. Does anybody know if there's any built-in functionality I can use, or if not, what the best trigger point would be?

Discussion (2)0
Log in or sign up to continue

To add an OnLogin callback method, you must create a personal community Interface class which extends Acct.Interface.  That class should override the OnLogin method which takes a %ZEN.proxyObject as an argument and returns a %Status.  The %ZEN.proxyObject will have a "Username" property populated.

Once you've compiled your new interface class, you can register it with personal community with:

w ##class(Acct.Config).SetInterfaceClass(<name of class>)

If you want this method to send Ensemble messages, you'll need a custom business service which sends the messages, and you'll have to invoke it with CreateBusinessService/ProcessInput as described here:

http://localhost:57774/csp/docbook/DocBook.UI.Page.cls?KEY=EGDV_busservice_invoke

Adding an OnLogin() callback method (as suggested by the previous answer) will only work for the current
user's messages.  If the user is a proxy for some other principal, the user won't see the
principal's new messages.

The suggestion is to instead configure the SDAOperation setting on the SDA service
(HSPortal_SDAService) to send requests to an Ensemble component that triggers the request to
retrieve messages and forwards the message to the existing SDA operation (HSPortal_SDAOperation).

This has a few benefits:
- The account interface doesn't get touched
- The user would get notified of messages from all principals, not just the current user
- The work would occur in the background instead of blocking the login process