cancel
Showing results for 
Search instead for 
Did you mean: 

Reading notifications: An unexpected exception occurred during error processing

gregorw
Active Contributor
0 Kudos

Hello SAP Launchpad service team, Hi ramya.vasanth,

after the tip from Ramya to try again the Notification API I've tried to see the notification in the launchpad. But unfortunately it's not shown. In the Network tab of the developer tools I see a request to:

/v4/NotificationService.svc/Notifications?$expand=Actions,NavigationTargetParams&$orderby=CreatedAt%20desc&$filter=IsGroupHeader%20eq%20false&$skip=0&$top=10

which does return:

{
    "error": {
        "code": null,
        "message": "An unexpected exception occurred during error processing"
    }
}

Looking forward for a solution.

Best regards
Gregor

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Gregor,

I created the Notification type and Notification from the link https://github.com/gregorwolf/bookshop-demo/blob/main/tests/notification.http

I see that there are few changes required here.

1. In Notification Type payload, the TemplateLanguage under Templates needs to be Mustache (it has to be case insensitive, this is a bug on our end, we will fix this.)

2. Mustache template currently does not accept space and $ characters. Please change the templates.

3. In Notification payload, the OriginId is restricted to 16 characters (again this needs to be fixed from our end. The value will be changed to 200 characters).Please change the value for now.

4. Also, in Notification payload, under properties, the Key has to be the placeholder specified in notification type templates.

The correct Notification Type payload is

{
 "NotificationTypeKey": "LeaveRequest",
 "NotificationTypeVersion": "0.3",
 "Templates": [
 {
 "Language": "en",
 "TemplatePublic": "A new leave request needs ur attention!",
 "TemplateSensitive": "{{dotenv_TemplateSensitive}}",
 "TemplateGrouped": "{{dotenv_TemplateGrouped}}",
 "TemplateLanguage": "Mustache",
 "Subtitle": "Leave Request"
 }
 ],
 "Actions": [
 {
 "ActionId": "AcceptLRActionKey",
 "Language": "en",
 "ActionText": "Accept",
 "GroupActionText": "Accept All",
 "Nature": "POSITIVE"
 },
 {
 "ActionId": "RejectLRActionKey",
 "Language": "en",
 "ActionText": "Reject",
 "GroupActionText": "Reject All",
 "Nature": "NEGATIVE"
 }
 ]
}

The correct Notification payload is

{
 "OriginId": "leave-request",
 "NotificationTypeKey": "LeaveRequest",
 "NotificationTypeVersion": "0.3",
 "NavigationTargetAction": "display",
 "NavigationTargetObject": "LeaveRequest",
 "Priority": "High",
 "ActorId": "NAIRA",
 "ActorType": "",
 "ActorDisplayText": "",
 "ActorImageURL": "https://scn.sap.com/people/guest/avatar/NAIRA.png",
 "Properties": [
 {
 "Key": "dotenv_TemplateSensitive",
 "Language": "en",
 "Value": "me@sap.com",
 "Type": "String",
 "IsSensitive": false
 },
 {
 "Key": "dotenv_TemplateGrouped",
 "Language": "en",
 "Value": "05-01-2021",
 "Type": "String",
 "IsSensitive": true
 }
 ],
 "Recipients": [
 {
 "RecipientId": "ramya.vasanth@sap.com"
 }
 ]
}

Hope this helps !!

Regards,

Ramya

gregorw
Active Contributor
0 Kudos

Hi Ramya,

thank you for your detailed answer. I've updated my requests and I do receive now the notification in the Launchpad Service. But I have to say it doesn't feel reliable right now. Sometimes I get the Notification badge indicating a new notification, in other cases I have to click on the bell to see the new notification.

Also I would like you to update the documentation at Developing Cloud Foundry Applications With Notifications with the correct JSON payloads. Hope you've also seen my suggestion Use SAP Cloud SDK for Javascript in Documentation for Notifications as another improvement for the documentation.

Regarding the TemplateLanguage I would suggest to define an ENUM type that provides the possible values.

Best regards
Gregor

0 Kudos

Hi Gregor,

Thank you for the suggestions. We will update the documentation accordingly.

Regards,

Ramya

Answers (0)