informat.notification system notification
Overview
Use informat.notification to perform operations on system notifications.
queryNotificationListCount
Query the total count of system notifications that match the filter condition.
informat.notification.queryNotificationListCount(filter);| Parameter | Type | Description |
|---|---|---|
| filter | Filter | Filter condition |
Fields available for filtering
| Field | Type | Description |
|---|---|---|
| id | String | System notification ID |
| accountId | String | Account ID |
| name | String | Name |
| type | String | Type |
| content | String | Content |
| isRead | Boolean | Whether it has been read |
| isWebSend | String | Whether sent via web |
| isDingTalkSend | String | Whether sent via DingTalk |
| isFeishuSend | String | Whether sent via Feishu |
| createTime | String | Creation time |
Return value
Type: Integer Returns the total count of system notifications that match the filter condition.
Example
const count = informat.notification.queryNotificationListCount({
conditionList: [
{
fieldId: "accountId",
opt: "eq",
value: "x38s0fa436v69",
},
],
});
// Get the matched list
console.log("count:", count);queryNotificationList
Query the system notification list that matches the query condition.
informat.notification.queryNotificationList(query);| Parameter | Type | Description |
|---|---|---|
| query | Query | Query condition |
Fields available for filtering
| Field | Type | Description |
|---|---|---|
| id | String | System notification ID |
| accountId | String | Account ID |
| name | String | Name |
| type | String | Type |
| content | String | Content |
| isRead | Boolean | Whether it has been read |
| isWebSend | String | Whether sent via web |
| isDingTalkSend | String | Whether sent via DingTalk |
| isFeishuSend | String | Whether sent via Feishu |
| createTime | String | Creation time |
Return value
Type: Array<Notification> Returns the system notification list that matches the query condition.
Example
const notificationList = informat.notification.queryNotificationList({
pageIndex: 1,
pageSize: 20,
filter: {
conditionList: [
{
fieldId: "accountId",
opt: "eq",
value: "x38s0fa436v69",
},
],
},
});
// Get the system notification list
console.log("notificationList:", notificationList);updateNotification
Update the system notification.
informat.notification.updateNotification(notification);| Parameter | Type | Description |
|---|---|---|
| notification | Notification | System notification |
Fields available for updating
| Field | Type | Description |
|---|---|---|
| isWebSend | Boolean | Whether sent via websocket |
| isWeworkSend | Boolean | Whether sent via enterprise Wechat |
| isDingTalkSend | Boolean | Whether sent via DingTalk |
| isFeishuSend | Boolean | Whether sent via Feishu |
| isCustomSend | Boolean | Whether sent via custom notification |
Return value
Type: Integer Returns the number of records updated.
Example
informat.notification.updateNotification({
id: "e15ab1jmdjyl8",
isWebSend: true,
isWeworkSend: true,
isDingTalkSend: true,
isFeishuSend: true,
isCustomSend: true,
});deleteNotification
Delete the system notification.
informat.notification.deleteNotification(id);| Parameter | Type | Description |
|---|---|---|
| id | String | System notification ID |
Return value
Type: Integer Returns the number of records deleted.
Example
informat.notification.deleteNotification("b8ynqdu6z31ry");queryCustomNotificationListCount
Query the total count of system notifications that match the filter condition and have not been sent via custom notification.
informat.notification.queryCustomNotificationListCount(filter);| Parameter | Type | Description |
|---|---|---|
| filter | Filter | Filter condition |
Fields available for filtering
| Field | Type | Description |
|---|---|---|
| id | String | System notification ID |
| accountId | String | Account ID |
| name | String | Name |
| type | String | Type |
| content | String | Content |
| isWebSend | String | Whether sent via websocket |
| isDingTalkSend | String | Whether sent via DingTalk |
| isFeishuSend | String | Whether sent via Feishu |
| createTime | String | Creation time |
Return value
Type: Integer Returns the total count of system notifications that match the filter condition.
Example
const count = informat.notification.queryCustomNotificationListCount({
conditionList: [
{
fieldId: "accountId",
opt: "eq",
value: "x38s0fa436v69",
},
],
});
// Get the matched list
console.log("count:", count);queryCustomNotificationList
Query the system notification list that match the filter condition and have not been sent via custom notification.
informat.notification.queryCustomNotificationList(query);| Parameter | Type | Description |
|---|---|---|
| query | Query | Query condition |
Fields available for filtering
| Field | Type | Description |
|---|---|---|
| id | String | System notification ID |
| accountId | String | Account ID |
| name | String | Name |
| type | String | Type |
| content | String | Content |
| isWebSend | String | Whether sent via websocket |
| isDingTalkSend | String | Whether sent via DingTalk |
| isFeishuSend | String | Whether sent via Feishu |
| createTime | String | Creation time |
Return value
Type: Array<Notification> Returns the system notification list that match the filter condition.
Example
const notificationList = informat.notification.queryCustomNotificationList({
pageIndex: 1,
pageSize: 20,
filter: {
conditionList: [
{
fieldId: "accountId",
opt: "eq",
value: "x38s0fa436v69",
},
],
},
});
// Get the matched list
console.log("notificationList:", notificationList);sendNotification
Send the system notification.
informat.notification.sendNotification(notification);| Parameter | Type | Description |
|---|---|---|
| notification | NotificationForm | System notification form |
Return value
Type: String Returns the system notification ID.
Example
const notificationId = informat.notification.sendNotification({
title: "Notification title",
content: "Notification content",
accountId: informat.app.userId(),
type: "openurl", // openurl||openrecord|openbpmntask
urlSetting: {
url: "https://next.informat.cn/",
isAppURL: false,
},
recordSetting: {
recordId: null,
moduleId: null,
},
bpmnTaskSetting: {
taskId: null,
moduleId: null,
},
});
// Get the notification ID
console.log("notificationId:", notificationId);setCustomNotificationSent
Set the custom notification as sent.
TIP
Setting the notification as sent will update the notificationSent.isCustomSend field to true (sent).
informat.notification.setCustomNotificationSent(notificationId);| Parameter | Type | Description |
|---|---|---|
| notificationId | String | System notification ID |
Example
const notificationList = informat.notification.queryCustomNotificationList({
pageIndex: 1,
pageSize: 20,
filter: {
conditionList: [
{
fieldId: "accountId",
opt: "eq",
value: "x38s0fa436v69",
},
],
},
});
notificationList.forEach((notification) => {
console.log("notification:", notification);
// do smth
informat.notification.setCustomNotificationSent(notification.id);
});setThreadLocalEnableNotify
Setting the thread-local variable to enable/disable notifications for the current application.
informat.notification.setThreadLocalEnableNotify(enable);| Parameter | Type | Description |
|---|---|---|
| enable | Boolean | Whether to enable notifications |
Example
informat.notification.setThreadLocalEnableNotify(true);isThreadLocalEnableNotify
Get the thread-local variable that indicates whether notifications are enabled for the current app.
informat.notification.isThreadLocalEnableNotify();Return value
Type: Boolean Returns whether notifications are enabled.
Example
informat.notification.isThreadLocalEnableNotify();
