informat.app Application Information Functions
Overview
Use the informat.app object to perform application-related global operations.
abort
Terminate the execution of the current script
informat.app.abort(message);
informat.app.abort(message, code);Parameters
| Parameter | Type | Description |
|---|---|---|
| message | String | Prompt message |
| code | int | Error code |
Return Value
None
Example
informat.app.abort("Current project has been initiated");
informat.app.abort("Current project has been initiated", 270001);appId
Query the current application ID
informat.app.appId();Return Value
Type: String, returns the current application ID
Example
const appId = informat.app.appId();
console.log(appId);y2jtobhqycwxbgetAppIdByKey
Query the application ID under the team through the application identifier
informat.app.getAppIdByKey(key);Parameters
| Parameter | Type | Description |
|---|---|---|
| key | String | Application identifier |
Return Value
Type: String, returns the application ID
Example
const appId = informat.app.getAppIdByKey("informat.example");
console.log(appId);y2jtobhqycwxbgetModuleIdByKey
Query the module ID through the module identifier
informat.app.getModuleIdByKey(key);Parameters
| Parameter | Type | Description |
|---|---|---|
| key | String | Module identifier |
Return Value
Type: String, returns the module ID
Example
const moduleId = informat.app.getModuleIdByKey("dataModelBasics");
console.log(moduleId);ww0wfsota14xmgetModuleKeyById
Query the module identifier through the module ID
informat.app.getModuleKeyById(id);Parameters
| Parameter | Type | Description |
|---|---|---|
| id | String | Module ID |
Return Value
Type: String, returns the module identifier
Example
const moduleId = informat.app.getModuleKeyById("ww0wfsota14xm");
console.log(moduleId);dataModelBasicsuserId
Query the current operation user ID
informat.app.userId();Return Value
Type: String, returns the current user ID
Example
const userId = informat.app.userId();
console.log(userId);zhangsanappDefine
Get the configuration information of the current application
informat.app.appDefine();Return Value
Type: AppDefine, returns the configuration information of the current application
Example
const appDefine = informat.app.appDefine();
console.log(appDefine);{
"apiList": [],
"automaticList": [
{
"directory": false,
"expand": false,
"id": "kg93tarx7z0ni",
"isDirectory": false,
"key": "kg93tarx7z0ni",
"name": "Excel to PDF",
"type": "default"
},
{
"directory": false,
"expand": false,
"id": "pk7azjbk73fm3",
"isDirectory": false,
"key": "pk7azjbk73fm3",
"name": "Publish App Event",
"type": "default"
},
{
"directory": false,
"expand": false,
"id": "a1ns3a7wu1nw7",
"isDirectory": false,
"key": "a1ns3a7wu1nw7",
"name": "Publish App Time",
"type": "default"
}
],
"color": "c1",
"eventList": [
{
"id": "gzginycn5nk4",
"key": "shijian",
"name": "Publish Event"
}
],
"id": "excel2pdf",
"moduleList": [
{
"directory": false,
"expand": false,
"icon": "table",
"id": "v10lxegyp7q9x",
"isDirectory": false,
"key": "tab",
"name": "Data Table",
"type": "Table"
}
],
"name": "Partition Example",
"roleList": [
{
"directory": false,
"expand": false,
"id": "lzlq4xtzj7wa0",
"isDirectory": false,
"key": "admin",
"name": "Administrator"
}
],
"scheduleList": [],
"scriptList": [],
"versionList": []
}moduleTree
Get the module tree
informat.app.moduleTree();Return Value
Type: Array<ObjectRef>, returns the module list
Example
const moduleTree = informat.app.moduleTree();
console.log(moduleTree);[
{
"directory": false,
"expand": false,
"icon": "table",
"id": "ww0wfsota14xm",
"isDirectory": false,
"key": "dataModelBasics",
"name": "Basic Data Table Model",
"type": "Table"
},
{
"children": [
{
"children": [
{
"directory": false,
"expand": false,
"icon": "table",
"id": "fq8npovpr6xwq",
"isDirectory": false,
"key": "fq8npovpr6xwq",
"name": "Data Table xx",
"type": "Table"
}
],
"directory": true,
"expand": false,
"icon": "arrow-up-circle",
"id": "bo6uz2zshv8u",
"isDirectory": true,
"name": "Group 11",
"type": "Group"
}
],
"directory": true,
"expand": false,
"icon": "corner-down-right",
"id": "d6l87tqgh3s9",
"isDirectory": true,
"name": "Group 1",
"type": "Group"
}
]weworkAccessToken
Get WeWork AccessToken
informat.app.weworkAccessToken();Return Value
Type String, WeWork AccessToken
Example
const accessToken = informat.app.weworkAccessToken();
console.log(accessToken);Jnr6FjCpHbUJEZXdM0TzpaOMRCu_EnzsdOUALv42Y5enbCk6cW0jbr0VRgQKBMC21mJQpg_GaL8Phw4ge8a1Q1S7fW-yXUOIIAmX6XIeQOfNvOLPO1i2s6Ttnj523qgDwUknn_ARswFbbQnrfz2NbCG_cJIikg9VSXZn4Ba6HjtEGFINNLrs554Bv8SLpz6rMcn6AbDtcM7dxf_uqN3vaAdingtalkAccessToken
Get DingTalk AccessToken
informat.app.dingtalkAccessToken();Return Value
Type String, DingTalk AccessToken
Example
const accessToken = informat.app.dingtalkAccessToken();
console.log(accessToken);05c3b2cea02d3916a892b73d00d36225feishuAccessToken
Get Feishu Application AccessToken
informat.app.feishuAccessToken();Return Value
Type String, Feishu Application AccessToken
Example
const accessToken = informat.app.feishuAccessToken();
console.log(accessToken);a-g10459b02LHUFLQFU7BRRQDAEEFPP2ZV2S65PQK6feishuTenantAccessToken
Get Feishu Tenant AccessToken
informat.app.feishuTenantAccessToken();Return Value
Type String, Feishu Tenant AccessToken
Example
const accessToken = informat.app.feishuTenantAccessToken();
console.log(accessToken);t-g10459b02LHUFLQFU7BRRQDAEEFPP2ZV2S65PQK6appEnvProp
Get environment variable value
informat.app.appEnvProp(id);Parameters
| Parameter | Type | Description |
|---|---|---|
| id | String | Environment variable ID |
Return Value
Type String, environment variable value
informat.app.appEnvProp("host");http://dev.informat.cnshowModuleAlert
Set module alert message;
informat.app.showModuleAlert(moduleAlert);Note
Module alert messages are displayed at the top of the module page and are used to show descriptive text. For example, showing the current import progress when importing data.
Parameters
| Parameter | Type | Description |
|---|---|---|
| moduleAlert | ModuleAlert | Alert message |
Example
informat.app.showModuleAlert({
moduleId: "task",
title: "Input is being imported",
description: "Currently importing 40/100",
type: "info",
});hideModuleAlert
Hide module alert
informat.app.hideModuleAlert(moduleId);Parameters
| Parameter | Type | Description |
|---|---|---|
| moduleId | String | Module identifier |
Example
informat.app.hideModuleAlert("task");invokeAutomatic
Call automation program;
informat.app.invokeAutomatic(automaticId, args);Note
- If automation program does not exist then throw exception
- If automation program does not return value then
null
Parameters
| Parameter | Type | Description |
|---|---|---|
| automaticId | String | Automation program identifier |
| args | Array<Object> | Parameter list |
Return Value
Type Object, automation program return value
Example
informat.app.invokeAutomatic("addAutomatic", [1, 2]);3pushEvent
Push event to client
informat.app.pushEvent(event);Parameters
| Parameter | Type | Description |
|---|---|---|
| event | PushEvent | Event data |
Example
informat.app.pushEvent({
eventId: "ModuleRefresh",
moduleRefreshModuleId: "task",
});informat.app.pushEvent({
eventId: "Toast",
toastMessage: "Zhang San deleted record test",
});informat.app.pushEvent({
eventId: "RecordFormRefresh",
recordFormRefreshTableId: "task",
recordFormRefreshRecordId: "sf2lk7c7ctzyq",
});publishAppEvent
Publish app event
informat.app.publishAppEvent(event);Note
- Other apps in the team can receive event messages through listeners
Parameters
| Parameter | Type | Description |
|---|---|---|
| event | AppEvent | App event |
Example
informat.app.publishAppEvent({
id: "publishFromSript",
content: {
user: "Zhang San",
},
});queryCustomRoleList
Query custom role list
informat.app.queryCustomRoleList(query);Parameters
| Parameter | Type | Description |
|---|---|---|
| query | Query | Query condition |
Available fields for filter
| Parameter | Type | Description |
|---|---|---|
| name | String | Name |
Example
Query custom role list with name containing General Manager
informat.app.queryCustomRoleList({
pageIndex: 1,
pageSize: 100,
filter: {
conditionList: [
{
fieldId: "name",
opt: "contains",
value: "General Manager",
},
],
},
});[
{
"createTime": 1709884168637,
"id": "ceo",
"name": "General Manager",
"permissionList": ["AppAccess", "AppMember", "...", "zu2whl8gk09j9_ExternalAccess", "printDesigner_DashboardAccess"],
"updateTime": 1717065850763
}
]queryCustomRoleListCount
Query custom role list count
informat.app.queryCustomRoleListCount(filter);Parameters
| Parameter | Type | Description |
|---|---|---|
| filter | Filter | Query condition |
Example
Query total count of custom roles with name containing General Manager
informat.app.queryCustomRoleListCount({
conditionList: [
{
fieldId: "name",
opt: "contains",
value: "General Manager",
},
],
});1addCustomRole
Add custom role
informat.app.addCustomRole(role);| Parameter | Type | Description |
|---|---|---|
| role | CustomRole | Custom role |
Example
informat.app.addCustomRole({
id: "supplier",
name: "Supplier",
remark: "Directly provide goods and corresponding services to retailers",
permissionList: ["AppAccess", "user_TableAccess"],
});updateCustomRole
Update custom role
informat.app.updateCustomRole(role);Parameters
| Parameter | Type | Description |
|---|---|---|
| role | CustomRole | Custom role |
Return Value
Type Integer Number of records updated
Example
informat.app.updateCustomRole({
id: "supplier",
name: "Main Supplier",
remark: "Directly provide goods and corresponding services to retailers",
permissionList: ["AppAccess", "user_TableAccess", "user_TableInsert"],
});1deleteCustomRole
Delete custom role
informat.app.deleteCustomRole(id);| Parameter | Type | Description |
|---|---|---|
| id | String | Custom role identifier |
Return Value
Type Integer Number of records deleted
Example
informat.app.deleteCustomRole("supplier");1setAppBadge
Set app badge
informat.app.setAppBadge(content);Parameters
| Parameter | Type | Description |
|---|---|---|
| content | String | App badge content |
Example
informat.app.setAppBadge("Important");favoriteModule
Favorite module
informat.app.favoriteModule(moduleList);| Parameter | Type | Description |
|---|---|---|
| moduleList | Array<String> | Module identifier list |
Return Value
Type Array<String> Favorite record ID list
Example
informat.app.favoriteModule(["scriptTableA", "scriptTableB"]);["gh2lsh2sgnnms", "f52xscr7c77u0"]cancelFavoriteModule
Cancel favorite module
informat.app.cancelFavoriteModule(moduleList);| Parameter | Type | Description |
|---|---|---|
| moduleList | Array<String> | Module identifier list |
Return Value
Type Integer Number of records affected by canceling favorites
Example
informat.app.cancelFavoriteModule(["scriptTableA", "scriptTableB"]);2queryFavoriteModuleList
Query my favorite module list(this application's module)
informat.app.queryFavoriteModuleList(query);| Parameter | Type | Description |
|---|---|---|
| query | Query | Query condition |
Available fields for filter
| Parameter | Type | Description |
|---|---|---|
| moduleName | String | Module name |
Return Value
Type Array<ModuleFavorite>,My favorite module list
Example
Query favorite module list with name containing Task
informat.app.queryFavoriteModuleList({
pageIndex: 1,
pageSize: 100,
filter: {
conditionList: [
{
fieldId: "moduleName",
opt: "contains",
value: "Task",
},
],
},
});[
{
"accountId": "yvkc2kwpy3xzr",
"applicationId": "i1mwqy35y88hl",
"id": "n9m98qmomke3g",
"moduleIcon": "noto-slightly-smiling-face",
"moduleId": "vylzhve0zrehp",
"moduleName": "Welcome",
"moduleType": "Dashboard"
}
]queryFavoriteModuleListCount
Query my favorite module list count(this application's module)
informat.app.queryFavoriteModuleListCount(filter);| Parameter | Type | Description |
|---|---|---|
| filter | Filter | Query condition |
Return Value
Type Integer,Total number of my favorite modules
Example
Query total count of favorite modules with name containing Task
informat.app.queryFavoriteModuleListCount({
conditionList: [
{
fieldId: "moduleName",
opt: "contains",
value: "Task",
},
],
});1eval
Run script
informat.app.eval(script);| Parameter | Type | Description |
|---|---|---|
| script | String | JS script content |
Return Value
Type Object,Script execution result
Example
informat.app.eval(`
let date = new Date()
console.log(date);`);Fri May 31 10:11:55 CST 2024appInfo
App runtime information
informat.app.appInfo();Return Value
TypeApplication, script execution result
Example
informat.app.appInfo();{
"appDefineBuild": 863,
"appDefineEditable": true,
"appDefineVersion": "17",
"appDefineId": "com.mycompany",
"color": "c7",
"createAccountId": "zhangsan",
"createTime": 1680006873433,
"icon": "home",
"id": "ftegr30w93jya",
"enableAppJsonLog": false,
"enableAppLog": false,
"env": "dev",
"name": "Test Application",
"updateAccountId": "zhangsan",
"updateTime": 1696919628896
}runSchedule
Run scheduled task
informat.app.runSchedule(key);Note
A successful run will affect the execution time of the next scheduled task. For example, if a scheduled task runs every hour and the last execution time was 19:30, the next execution time would be 20:30. If a user calls this interface to run the scheduled task at 20:10, the next execution time would be 21:10 instead of 20:30.
| Parameter | Type | Description |
|---|---|---|
| key | String | Scheduled task identifier |
Return Value
None
Example
informat.app.runSchedule("ao8ymduy4jt2p");getPerformanceStatistics
Return current app performance statistics list
informat.app.getPerformanceStatistics();Return Value
Type Array<ApplicationProcess> Current app performance statistics list
Example
informat.app.getPerformanceStatistics();[
{
"associatedId": "xxx_eval_lan5wqq9au2ls",
"associatedKey": "xxx_eval_lan5wqq9au2ls",
"associatedName": "xxx_eval_lan5wqq9au2ls",
"id": "biy9wnye6i4bd",
"serverId": "informat-biz2-prd",
"startTime": 1717068263865,
"status": "running",
"type": "script"
},
{
"associatedId": "xxxx_eval_s67wnu06xntlc",
"associatedKey": "xxx_eval_s67wnu06xntlc",
"associatedName": "xxx_eval_s67wnu06xntlc",
"endTime": 1717068247296,
"id": "oaqm8xgyz7m3z",
"serverId": "informat-biz2-prd",
"startTime": 1717068247294,
"status": "success",
"type": "script"
}
]queryAppChangeLogList
Query app operation log list
informat.app.queryAppChangeLogList(query);Parameters
| Parameter | Type | Description |
|---|---|---|
| query | Query | Query condition |
List of fields available in the filter
| Parameter | Type | Description |
|---|---|---|
| type | String | Type |
| createAccountId | String | Creator ID |
Example
Query app operation log list with type MemberUpdate
informat.app.queryAppChangeLogList({
pageIndex: 1,
pageSize: 100,
filter: {
conditionList: [
{
fieldId: "type",
opt: "eq",
value: "MemberUpdate",
},
],
},
});[
{
"content": "{\"avatar\":\"bc57a52b30c648c6bdba32c41b2f5371.jpg\",\"id\":\"skydu\",\"name\":\"Zhang San\",\"newRoleList\":[\"Administrator\"],\"oldRoleList\":[\"Administrator\",\"Member\"]}",
"createAccountAvatar": "bc57a52b30c648c6bdba32c41b2f5371.jpg",
"createAccountId": "zhangsan",
"createAccountName": "Zhang San",
"createTime": 1719212372446,
"id": "uvxmqtn5337cv",
"type": "MemberUpdate"
}
]queryAppChangeLogListCount
Query app operation log list count
informat.app.queryAppChangeLogListCount(filter);Parameters
| Parameter | Type | Description |
|---|---|---|
| filter | Filter | Query condition |
Example
Query the total number of custom role lists containing General Manager in the name
informat.app.queryAppChangeLogListCount({
conditionList: [
{
fieldId: "type",
opt: "eq",
value: "MemberUpdate",
},
],
});1addAppChangeLog
Create app change log
informat.app.addAppChangeLog(content);Parameters
| Parameter | Type | Description |
|---|---|---|
| content | String | Change content |
Example
informat.app.addAppChangeLog("Create record");deleteAppChangeLog
Delete app change log
informat.app.deleteAppChangeLog(id);Parameters
| Parameter | Type | Description |
|---|---|---|
| id | String | App log ID |
Example
informat.app.deleteAppChangeLog("nf6k7cf5u80ca");addDesignerUserList
Add app designer user list
informat.app.addDesignerUserList(type, userIdList);Parameters
| Parameter | Type | Description |
|---|---|---|
| type | String | App design permission type |
| userIdList | Array<String> | Account ID array |
Application design permission type options:
| Parameter | Description |
|---|---|
| access | Can access app design interface |
| edit | Can design app |
| publish | Can publish app |
Example
informat.app.addDesignerUserList("access", [informat.app.userId()]);
informat.app.addDesignerUserList("edit", [informat.app.userId()]);
informat.app.addDesignerUserList("publish", [informat.app.userId()]);Note
App design modification members and app design publishing members are empty by default. When empty, all members have modification and publishing permissions by default. Calling
addDesignerUserListandremoveDesignerUserListat this time may produce unexpected results.To manage members' modification and publishing permissions, you should configure the corresponding modification and publishing members.
getDesignerUserList
Query app designer user list
informat.app.getDesignerUserList(type);Parameters
| Parameter | Type | Description |
|---|---|---|
| type | String | App design permission type |
Optional values for application design permission types:
| Parameter | Description |
|---|---|
| access | Can enter application design interface |
| edit | Can perform application design |
| publish | Can publish application |
Example
informat.app.getDesignerUserList("access");["lwfwqr67xsvup", "uc4qsqmm64nep", "zhansan", "lisi"]removeDesignerUserList
Remove app designer user list
informat.app.removeDesignerUserList(type, userIdList);Parameters
| Parameter | Type | Description |
|---|---|---|
| type | String | App design permission type |
| userIdList | Array<String> | Account ID array |
Optional values for application design permission types:
| Parameter | Description |
|---|---|
| access | Can enter application design interface |
| edit | Can perform application design |
| publish | Can publish application |
Example
informat.app.removeDesignerUserList("access", [informat.app.userId()]);
informat.app.removeDesignerUserList("edit", [informat.app.userId()]);
informat.app.removeDesignerUserList("publish", [informat.app.userId()]);userLoginType
Query the login type of the currently operating user
informat.app.userLoginType();Return Value
Type: String, returns the login type of the currently operating user
const userLoginType = informat.app.userLoginType();
console.log(userLoginType);index
