Custom email notification with Identity Management 8.0
The notification functionality in SAP Identity Management 8.0 is available to you with the Notification package of the SAP Provisioning Framework. The notification package com.sap.idm.util.notification contains the notification process and the notification templates, which are used to send emails for approval and attestation tasks.
If you want to trigger a notification because of an SAP Provisioning Framework process, specify the value of the appropriate NOTIFYEVENT package constant to point to the template (a unique template ID) that you want to use: The most commonly used notification events are handled by this package:
- NOTIFYEVENT_ASSIGNMENT_COMPLETED – Privilege assignment notification
- NOTIFYEVENT_ASSIGNMENT_FAILED – Assignment failed notification
- NOTIFYEVENT_ASSIGNMENT_REVOKED – Privilege removal notification
- NOTIFYEVENT_PASSWORD_CHANGED – Changed password notification
- NOTIFYEVENT_USER_MODIFIED – Modified user notification
- NOTIFYEVENT_USERACCOUNT_CREATED – Created user notification
- NOTIFYEVENT_USERACCOUNT_DELETED – Deleted user notification
- NOTIFYEVENT_USERACCOUNT_DISABLED – Disabled user notification
- NOTIFYEVENT_USERACCOUNT_ENABLED – Enabled user notification
If you need to configure a mechanism for notification for other events, such as custom process completion or in case of any error, you can use the uSendSMTPMessage internal function. In this article I will give you a simple example for triggering notification for a process completion.
1. In the Identity Management Developer Studio tree view, check out a package and create a process. Rename the process to “doSthProcess”.
2. In the process flow diagram, add an action task to the process. Rename it to ExportIdentitiesTask.
3. In the job view, select the Passes tab and choose New from the context menu. Select a pass of type ToASCII and rename it to ExportIdentitiesPass.
Open ExportIdentitiesPass pass and define as a Source MX_PERSON entry.
As for Destination define the file location, for example ‘C:\tmp\identities.txt’ and the list of attributes you need to export:
5. In the Identity Management Developer Studio tree view, select the Scripts node of the package that you have checked out and add a new package script. Enter the following name for the script: sendingIdentitiesScript.
The variable attachmentLocation points to the toASCII pass file location in this case.
You may add additional logic for the dynamically creation of either text message or subject.
An example of the script is attached to the article.
6. Go back to the job view where you have created the pass ExportIdentitiesPass. Select the Scripts tab and then select Add Link to Package Script from the context menu.
In the Connection to Package Script dialog, select Self from the Select Package drop-down menu.
Select our new script sendingIdentitiesScript in order to be able to use it in the pass.
7. On the General tab of ExportIdentitiesPass pass, in the Termination Script drop-down menu, select sendingIdentitiesScript.
In similar way, you can define Initialization or Entry related scripts.
Now, you can test the example trough the Test Process feature and check your inbox for a new email with attachment 🙂 .
Related information you can find here :
Thanks for this useful information. Do you know if there is any way to leverage the Message Templates with custom notifications? It would be great if it were possible to maintain email templates using the standard framework and then use these for any custom notifications.
Thanks for the info. It will be nice, if you add in addition to the notification - an UI for management purposes. We have developed such a UI and the idea here is that the customer can manage the notification templates in an easier way by the UI - SAP IdM Custom Add-on for Notifications management - on WD&SAPUI5 . Please check it, when you have time and update me, if you find the idea interesting 🙂
Thanks for the suggestion. I had seen this blog before and it looks really smart!!
I have also raised this as an idea on the IdM ideas space as I feel it would be great to manage all notifications in the same manner.