{
"NotificationTypeKey": "REQUISITIONS",
"NotificationTypeVersion": "0.1",
"Templates": [
{
"Language": "en",
"TemplatePublic": "Requisitions",
"TemplateSensitive": "Requisition Sensitive Info",
"TemplateGrouped": "Purchase Requisitions",
"Subtitle": "Requisition Approval for {req_no} for {supplier_name}"
}
]
}
{
"source": "^/v2/(.*)$",
"csrfProtection": false,
"authenticationType": "xsuaa",
"destination": "SAP_Notifications"
},
sendNotification : function(oEvent){
var appId = this.getOwnerComponent().getManifestEntry("/sap.app/id");
var appPath = appId.replaceAll(".", "/");
var appModulePath = jQuery.sap.getModulePath(appPath);
var xsrfUrl = appModulePath + "/v2/NotificationType.svc/NotificationTypes";
var notificationUrl = appModulePath + "/v2/Notification.svc/Notifications";
var token;
var oPostData = {
"OriginId": "NA",
"NotificationTypeKey": "REQUISITIONS",
"NotificationTypeVersion": "0.1",
"Priority": "High",
"Properties": [
{
"Key": "req_no",
"Language": "en",
"Value": <replace with Requisition Number>
"Type": "String",
"IsSensitive": false
},
{
"Key": "supplier_name",
"Language": "en",
"Value": <replace with Supplier Name>
"Type": "String",
"IsSensitive": true
}
],
"Recipients": [
{
"RecipientId": <replace with receipient Id>
}
]
};
$.ajax({
url: xsrfUrl,
type: "GET",
beforeSend: function (xhr) { xhr.setRequestHeader("X-CSRF-Token", "Fetch"); },
complete: function (xhr) {
token = xhr.getResponseHeader("X-CSRF-Token");
$.ajax({
url: notificationUrl,
beforeSend: function (xhr) {
xhr.setRequestHeader('X-CSRF-Token', token);
xhr.setRequestHeader('Content-Type', "application/json; charset=utf-8");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("Accept", "*/*");
},
type: "POST",
async: false,
data: JSON.stringify(oPostData)
})
done(function (data, response) {
MessageBox.success("Notification sent successfully");
}.bind(this))
.fail(function (error) {
MessageBox.error("Notification not sent.");
}.bind(this));
}
});
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
10 | |
9 | |
7 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 | |
4 |