Skip to content

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

javascript
informat.app.abort(message);
informat.app.abort(message, code);

Parameters

ParameterTypeDescription
messageStringPrompt message
codeintError code

Return Value

None

Example

javascript
informat.app.abort("Current project has been initiated");
informat.app.abort("Current project has been initiated", 270001);

appId

Query the current application ID

javascript
informat.app.appId();

Return Value

Type: String, returns the current application ID

Example

javascript
const appId = informat.app.appId();
console.log(appId);
text
y2jtobhqycwxb

getAppIdByKey

Query the application ID under the team through the application identifier

javascript
informat.app.getAppIdByKey(key);

Parameters

ParameterTypeDescription
keyStringApplication identifier

Return Value

Type: String, returns the application ID

Example

javascript
const appId = informat.app.getAppIdByKey("informat.example");
console.log(appId);
text
y2jtobhqycwxb

getModuleIdByKey

Query the module ID through the module identifier

javascript
informat.app.getModuleIdByKey(key);

Parameters

ParameterTypeDescription
keyStringModule identifier

Return Value

Type: String, returns the module ID

Example

javascript
const moduleId = informat.app.getModuleIdByKey("dataModelBasics");
console.log(moduleId);
text
ww0wfsota14xm

getModuleKeyById

Query the module identifier through the module ID

javascript
informat.app.getModuleKeyById(id);

Parameters

ParameterTypeDescription
idStringModule ID

Return Value

Type: String, returns the module identifier

Example

javascript
const moduleId = informat.app.getModuleKeyById("ww0wfsota14xm");
console.log(moduleId);
text
dataModelBasics

userId

Query the current operation user ID

javascript
informat.app.userId();

Return Value

Type: String, returns the current user ID

Example

javascript
const userId = informat.app.userId();
console.log(userId);
text
zhangsan

appDefine

Get the configuration information of the current application

javascript
informat.app.appDefine();

Return Value

Type: AppDefine, returns the configuration information of the current application

Example

javascript
const appDefine = informat.app.appDefine();
console.log(appDefine);
json
{
  "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

javascript
informat.app.moduleTree();

Return Value

Type: Array<ObjectRef>, returns the module list

Example

javascript
const moduleTree = informat.app.moduleTree();
console.log(moduleTree);
json
[
  {
    "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

javascript
informat.app.weworkAccessToken();

Return Value

Type String, WeWork AccessToken

Example

javascript
const accessToken = informat.app.weworkAccessToken();
console.log(accessToken);
text
Jnr6FjCpHbUJEZXdM0TzpaOMRCu_EnzsdOUALv42Y5enbCk6cW0jbr0VRgQKBMC21mJQpg_GaL8Phw4ge8a1Q1S7fW-yXUOIIAmX6XIeQOfNvOLPO1i2s6Ttnj523qgDwUknn_ARswFbbQnrfz2NbCG_cJIikg9VSXZn4Ba6HjtEGFINNLrs554Bv8SLpz6rMcn6AbDtcM7dxf_uqN3vaA

dingtalkAccessToken

Get DingTalk AccessToken

javascript
informat.app.dingtalkAccessToken();

Return Value

Type String, DingTalk AccessToken

Example

javascript
const accessToken = informat.app.dingtalkAccessToken();
console.log(accessToken);
text
05c3b2cea02d3916a892b73d00d36225

feishuAccessToken

Get Feishu Application AccessToken

javascript
informat.app.feishuAccessToken();

Return Value

Type String, Feishu Application AccessToken

Example

javascript
const accessToken = informat.app.feishuAccessToken();
console.log(accessToken);
text
a-g10459b02LHUFLQFU7BRRQDAEEFPP2ZV2S65PQK6

feishuTenantAccessToken

Get Feishu Tenant AccessToken

javascript
informat.app.feishuTenantAccessToken();

Return Value

Type String, Feishu Tenant AccessToken

Example

javascript
const accessToken = informat.app.feishuTenantAccessToken();
console.log(accessToken);
text
t-g10459b02LHUFLQFU7BRRQDAEEFPP2ZV2S65PQK6

appEnvProp

Get environment variable value

javascript
informat.app.appEnvProp(id);

Parameters

ParameterTypeDescription
idStringEnvironment variable ID

Return Value

Type String, environment variable value

javascript
informat.app.appEnvProp("host");
text
http://dev.informat.cn

showModuleAlert

Set module alert message;

javascript
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

ParameterTypeDescription
moduleAlertModuleAlertAlert message

Example

javascript
informat.app.showModuleAlert({
  moduleId: "task",
  title: "Input is being imported",
  description: "Currently importing 40/100",
  type: "info",
});

hideModuleAlert

Hide module alert

javascript
informat.app.hideModuleAlert(moduleId);

Parameters

ParameterTypeDescription
moduleIdStringModule identifier

Example

js
informat.app.hideModuleAlert("task");

invokeAutomatic

Call automation program;

javascript
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

ParameterTypeDescription
automaticIdStringAutomation program identifier
argsArray<Object>Parameter list

Return Value

Type Object, automation program return value

Example

javascript
informat.app.invokeAutomatic("addAutomatic", [1, 2]);
text
3

pushEvent

Push event to client

javascript
informat.app.pushEvent(event);

Parameters

ParameterTypeDescription
eventPushEventEvent data

Example

javascript
informat.app.pushEvent({
  eventId: "ModuleRefresh",
  moduleRefreshModuleId: "task",
});
javascript
informat.app.pushEvent({
  eventId: "Toast",
  toastMessage: "Zhang San deleted record test",
});
javascript
informat.app.pushEvent({
  eventId: "RecordFormRefresh",
  recordFormRefreshTableId: "task",
  recordFormRefreshRecordId: "sf2lk7c7ctzyq",
});

publishAppEvent

Publish app event

javascript
informat.app.publishAppEvent(event);

Note

  • Other apps in the team can receive event messages through listeners

Parameters

ParameterTypeDescription
eventAppEventApp event

Example

javascript
informat.app.publishAppEvent({
  id: "publishFromSript",
  content: {
    user: "Zhang San",
  },
});

queryCustomRoleList

Query custom role list

javascript
informat.app.queryCustomRoleList(query);

Parameters

ParameterTypeDescription
queryQueryQuery condition

Available fields for filter

ParameterTypeDescription
nameStringName

Example

Query custom role list with name containing General Manager

javascript
informat.app.queryCustomRoleList({
  pageIndex: 1,
  pageSize: 100,
  filter: {
    conditionList: [
      {
        fieldId: "name",
        opt: "contains",
        value: "General Manager",
      },
    ],
  },
});
json
[
  {
    "createTime": 1709884168637,
    "id": "ceo",
    "name": "General Manager",
    "permissionList": ["AppAccess", "AppMember", "...", "zu2whl8gk09j9_ExternalAccess", "printDesigner_DashboardAccess"],
    "updateTime": 1717065850763
  }
]

queryCustomRoleListCount

Query custom role list count

javascript
informat.app.queryCustomRoleListCount(filter);

Parameters

ParameterTypeDescription
filterFilterQuery condition

Example

Query total count of custom roles with name containing General Manager

javascript
informat.app.queryCustomRoleListCount({
  conditionList: [
    {
      fieldId: "name",
      opt: "contains",
      value: "General Manager",
    },
  ],
});
text
1

addCustomRole

Add custom role

javascript
informat.app.addCustomRole(role);
ParameterTypeDescription
roleCustomRoleCustom role

Example

javascript
informat.app.addCustomRole({
  id: "supplier",
  name: "Supplier",
  remark: "Directly provide goods and corresponding services to retailers",
  permissionList: ["AppAccess", "user_TableAccess"],
});

updateCustomRole

Update custom role

javascript
informat.app.updateCustomRole(role);

Parameters

ParameterTypeDescription
roleCustomRoleCustom role

Return Value

Type Integer Number of records updated

Example

javascript
informat.app.updateCustomRole({
  id: "supplier",
  name: "Main Supplier",
  remark: "Directly provide goods and corresponding services to retailers",
  permissionList: ["AppAccess", "user_TableAccess", "user_TableInsert"],
});
text
1

deleteCustomRole

Delete custom role

javascript
informat.app.deleteCustomRole(id);
ParameterTypeDescription
idStringCustom role identifier

Return Value

Type Integer Number of records deleted

Example

javascript
informat.app.deleteCustomRole("supplier");
text
1

setAppBadge

Set app badge

javascript
informat.app.setAppBadge(content);

Parameters

ParameterTypeDescription
contentStringApp badge content

Example

javascript
informat.app.setAppBadge("Important");

favoriteModule

Favorite module

javascript
informat.app.favoriteModule(moduleList);
ParameterTypeDescription
moduleListArray<String>Module identifier list

Return Value

Type Array<String> Favorite record ID list

Example

javascript
informat.app.favoriteModule(["scriptTableA", "scriptTableB"]);
json
["gh2lsh2sgnnms", "f52xscr7c77u0"]

cancelFavoriteModule

Cancel favorite module

javascript
informat.app.cancelFavoriteModule(moduleList);
ParameterTypeDescription
moduleListArray<String>Module identifier list

Return Value

Type Integer Number of records affected by canceling favorites

Example

javascript
informat.app.cancelFavoriteModule(["scriptTableA", "scriptTableB"]);
text
2

queryFavoriteModuleList

Query my favorite module list(this application's module)

javascript
informat.app.queryFavoriteModuleList(query);
ParameterTypeDescription
queryQueryQuery condition

Available fields for filter

ParameterTypeDescription
moduleNameStringModule name

Return Value

Type Array<ModuleFavorite>,My favorite module list

Example

Query favorite module list with name containing Task

javascript
informat.app.queryFavoriteModuleList({
  pageIndex: 1,
  pageSize: 100,
  filter: {
    conditionList: [
      {
        fieldId: "moduleName",
        opt: "contains",
        value: "Task",
      },
    ],
  },
});
json
[
  {
    "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)

javascript
informat.app.queryFavoriteModuleListCount(filter);
ParameterTypeDescription
filterFilterQuery condition

Return Value

Type Integer,Total number of my favorite modules

Example

Query total count of favorite modules with name containing Task

javascript
informat.app.queryFavoriteModuleListCount({
  conditionList: [
    {
      fieldId: "moduleName",
      opt: "contains",
      value: "Task",
    },
  ],
});
text
1

eval

Run script

javascript
informat.app.eval(script);
ParameterTypeDescription
scriptStringJS script content

Return Value

Type Object,Script execution result

Example

javascript
informat.app.eval(`
        let date = new Date()
        console.log(date);`);
text
Fri May 31 10:11:55 CST 2024

appInfo

App runtime information

javascript
informat.app.appInfo();

Return Value

TypeApplication, script execution result

Example

javascript
informat.app.appInfo();
json
{
  "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

javascript
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.

ParameterTypeDescription
keyStringScheduled task identifier

Return Value

None

Example

javascript
informat.app.runSchedule("ao8ymduy4jt2p");

getPerformanceStatistics

Return current app performance statistics list

javascript
informat.app.getPerformanceStatistics();

Return Value

Type Array<ApplicationProcess> Current app performance statistics list

Example

javascript
informat.app.getPerformanceStatistics();
json
[
  {
    "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

javascript
informat.app.queryAppChangeLogList(query);

Parameters

ParameterTypeDescription
queryQueryQuery condition

List of fields available in the filter

ParameterTypeDescription
typeStringType
createAccountIdStringCreator ID

Example

Query app operation log list with type MemberUpdate

javascript
informat.app.queryAppChangeLogList({
  pageIndex: 1,
  pageSize: 100,
  filter: {
    conditionList: [
      {
        fieldId: "type",
        opt: "eq",
        value: "MemberUpdate",
      },
    ],
  },
});
json
[
  {
    "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

javascript
informat.app.queryAppChangeLogListCount(filter);

Parameters

ParameterTypeDescription
filterFilterQuery condition

Example

Query the total number of custom role lists containing General Manager in the name

javascript
informat.app.queryAppChangeLogListCount({
  conditionList: [
    {
      fieldId: "type",
      opt: "eq",
      value: "MemberUpdate",
    },
  ],
});
text
1

addAppChangeLog

Create app change log

javascript
informat.app.addAppChangeLog(content);

Parameters

ParameterTypeDescription
contentStringChange content

Example

javascript
informat.app.addAppChangeLog("Create record");

deleteAppChangeLog

Delete app change log

javascript
informat.app.deleteAppChangeLog(id);

Parameters

ParameterTypeDescription
idStringApp log ID

Example

javascript
informat.app.deleteAppChangeLog("nf6k7cf5u80ca");

addDesignerUserList

Add app designer user list

js
informat.app.addDesignerUserList(type, userIdList);

Parameters

ParameterTypeDescription
typeStringApp design permission type
userIdListArray<String>Account ID array

Application design permission type options:

ParameterDescription
accessCan access app design interface
editCan design app
publishCan publish app

Example

js
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 addDesignerUserList and removeDesignerUserList at 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

js
informat.app.getDesignerUserList(type);

Parameters

ParameterTypeDescription
typeStringApp design permission type

Optional values for application design permission types:

ParameterDescription
accessCan enter application design interface
editCan perform application design
publishCan publish application

Example

javascript
informat.app.getDesignerUserList("access");
json
["lwfwqr67xsvup", "uc4qsqmm64nep", "zhansan", "lisi"]

removeDesignerUserList

Remove app designer user list

js
informat.app.removeDesignerUserList(type, userIdList);

Parameters

ParameterTypeDescription
typeStringApp design permission type
userIdListArray<String>Account ID array

Optional values for application design permission types:

ParameterDescription
accessCan enter application design interface
editCan perform application design
publishCan publish application

Example

js
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

js
informat.app.userLoginType();

Return Value

Type: String, returns the login type of the currently operating user

javascript
const userLoginType = informat.app.userLoginType();
console.log(userLoginType);
text
index