import ch.nevis.idm.client.IdmRestClient import ch.nevis.idm.client.IdmRestClientFactory String user_notification_dto = ''' { "clientExtId": "{{clientExtId}}", "userExtId": "{{userExtId}}", "notificationType": "userNotification3", "sendingMethod": [ "Email" ], "async": false } ''' IdmRestClient idmRestClient = IdmRestClientFactory.get(parameters) def sess = request.getAuthSession(true) String baseUrl = parameters.get("baseUrl") String clientExtId = parameters.get("clientExtId") String endPoint = "$baseUrl/api/notification/v1/" String userExtId = sess.getAttribute("ch.nevis.idm.User.extId") String restRequest = user_notification_dto.replaceAll("\\{\\{clientExtId}}", clientExtId).replaceAll("\\{\\{userExtId}}", userExtId) try { idmRestClient.post(endPoint, restRequest) }catch(Exception e) { LOG.error("Failed to send User Notification: Idm Update with EId data: ${e}") response.setResult('error') return } response.setResult('ok') return