Setting Menu Badges
Background
In a project management system, it is necessary to display the number of pending tasks in the task menu. This requirement can be achieved by Setting Menu Badges.
To refer to this section, you need to master the use of Listeners and the use of the Run Script on Client step in automation.
Data Table Definition
Task Table
| Field | Identifier | Type | Remarks |
|---|---|---|---|
| Task Name | name | Single Line Text | |
| Status | status | List Selection | Option values: Pending, Processed |
| Responsible Person | owner | User Selection |
Implementation Steps
We can implement this function through the following methods:
- Open the [Task Table] settings >> Basic Information >> Badge Content
js
${app.appData.toDoCount}- We need to add
User Enter Application Event,After Data Table Record Deletion (triggered by client),After Data Table Record Update (triggered by client),After Data Table Record Creation (triggered by client)in Global Settings >> Listeners. Ensure that when users enter the application and operate task data, automation is triggered to query the number of pending tasks and update the data inappData(application variables).
- Automation configuration triggered by listeners
Query the number of pending tasks, and run a script on the client to set the number of application variable toDoCount.
Run Script on Client
js
function run(context) {
const count = context.params.count;
informat.app.setAppData("toDoCount", count);
return "SUCCESS";
}
