Skip to content

Context

Overview

Context-related functions. Context represents environment parameters during execution

userId

Returns the current operating user ID

javascript
Context.userId()

Return Value

Type String Current operating user

Examples

javascript
Context.userId() //ek5veueb6c9zg

Tip

Context user only has a value when the operation is initiated by a user, for example, when in scheduled task execution or API access, the operating user is null

appId

Returns the current application ID

javascript
Context.appId()

Return Value

Type String Current application ID

Examples

javascript
Context.appId()

appEnvProp

Returns the environment variable of the current application

javascript
Context.appEnvProp(propKey)
ParameterTypeDescription
propKeyStringEnvironment variable key

Return Value

Type String Environment variable value

Examples

Assume the environment variables set in the application are as follows

EnvironmentVariable IdentifierVariable Value
devpayURLhttp://dev-demo.com/pay
prdpayURLhttp://prd-demo.com/pay
javascript
//When called in dev environment
Context.appEnvProp('payURL')//http://dev-demo.com/pay

Note

When used on the client side, only environment variables set to allow client-side access can be accessed. The server side has no such restriction

httpHeaders

Returns the http header of the current operation

javascript
Context.httpHeaders()

Return Value

Type Object http header values

Examples

TIP

If the operation is not triggered by a user (e.g., scheduled task, event handler), httpHeaders returns {}

clipboardType

Returns the data type stored in the current application clipboard

javascript
Context.clipboardType()

Return Value

Type String Data type stored in the application clipboard

Examples

javascript
Context.clipboardType() //test

The application clipboard needs to be set through the following operations

  • Automation step Set Application Clipboard
  • Control Set Application Clipboard Data

clipboardData

Returns the data stored in the current application clipboard

javascript
Context.clipboardData()

Return Value

Type Object Data stored in the application clipboard

weworkAccessToken

Returns WeChat Work AccessToken

javascript
Context.weworkAccessToken()

Return Value

Type String WeChat Work AccessToken

dingtalkAccessToken

Returns DingTalk AccessToken

javascript
Context.dingtalkAccessToken()

Return Value

Type String DingTalk AccessToken

feishuAccessToken

Returns Feishu Application AccessToken

javascript
Context.feishuAccessToken()

Return Value

Type String Feishu Application AccessToken

feishuTenantAccessToken

Returns Feishu Tenant AccessToken

javascript
Context.feishuTenantAccessToken()

requestIp

Returns the current request's IP information

javascript
Context.requestIp()

Return Value

Type String Returns the current request's IP information

hasAppPerm

Checks if the current user has application permission with identifier permKey

javascript
Context.hasAppPerm(permKey)
ParameterTypeDescription
permKeyStringPermission identifier

Return Value

Type Boolean Whether the user has the application permission

hasModulePerm

Checks if the current user has module permission with module identifier moduleKey and permission identifier permKey

javascript
Context.hasModulePerm(moduleKey, permKey);
ParameterTypeDescription
moduleKeyStringModule identifier
permKeyStringPermission identifier

Return Value

Type Boolean Whether the user has the module permission