Skip to content

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

FieldIdentifierTypeRemarks
Task NamenameSingle Line Text
StatusstatusList SelectionOption values: Pending, Processed
Responsible PersonownerUser Selection

Implementation Steps

We can implement this function through the following methods:

  1. Open the [Task Table] settings >> Basic Information >> Badge Content
js
${app.appData.toDoCount}
  1. 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 in appData (application variables).
  1. 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";
}

Effect