English
context
About 828 wordsAbout 3 min
2026-01-09
Retrieving Data Information for Objects Bound to Custom Functions
Supported context Data
| Category | Variable Name | Data | Remarks |
|---|---|---|---|
| General | context.tenantId | String, current tenant ID | Available for all functions |
| context.userId | String, current user ID | Available for all functions. -10000 indicates execution under system identity. Two scenarios: (1) Functions triggered directly via page operations use the actual operating user's ID; (2) Functions called via system background use -10000 indicating system identity execution. | |
| context.data | Map, main object data of the current operation | Available for functions triggered by buttons and workflows; For asynchronously processed fields such as aggregated fields, calculated fields, and lookup fields, values might be inaccurate. It is recommended to requery using FQL to obtain correct values. | |
| context.details | Map, sub-object data of the current operation | Debug loads only 6 sub-object records; normal runtime loads full data. Workflow functions created after April 1, 2024 no longer support context.details. | |
| context.dataList | List, batch data of the current operation | Functions triggered by bulk UI buttons receive the batch selected data. | |
| context.objectIds | List, ID list of the object data for the current operation | Available for functions bound to scheduled task objects. | |
| context.arg | Map, parameters passed from the business side | Business parameters are passed to the function through this property in specific business scenarios. | |
| Connectivity | context.outTenantId | String, current external connected tenant ID | Numeric value greater than 10,000,000. Available only for button EM6 connectivity requests. |
| context.outUserId | String, current external connected user ID | Numeric value greater than 10,000,000. Available only for button EM6 connectivity requests. | |
| context.appId | String, current connected application AppId | Available only for button EM6 connectivity requests. | |
| context.upstreamOwnerId | String, the upstream enterprise contact corresponding to the current downstream entity. | ||
| context.thirdType | String, downstream login method | 2: Fxiaoy; 4: WeChat Service Account; 5: Mini Program; 6: WeChat Scan Login; 7: Third-party Login; 8: WeChat Unified Login. | |
| context.thirdAppId | Application ID corresponding to the third-party login method | e.g., WeChat Service Account appid. | |
| context.thirdUserId | User ID corresponding to the third-party login method | e.g., open_id for WeChat Service Account. |
context Availability Across Scenarios
| Namespace | Business Type | Usage Scenario | Normal Runtime Context | Debug Context | Remarks |
|---|---|---|---|---|---|
| Button/Action | Custom Business Button | Pre-validation | context.data | context.data | Does not support details |
| (1) Custom Business Button; (2) Custom UI Button (Single Record) | Execution Action | (1) context.data; (2) context.details; (3) context.arg | (1) context.data; (2) context.details | ||
| Custom UI Button (Bulk) | Execution Action | context.dataList | context.dataList | This is a list of object data. | |
| (1) Create Save Button; (2) Edit Save Button | (1) Pre-validation; (2) Post-action; (3) Redirect Action | (1) context.data; (2) context.details; (3) context.arg | (1) context.data; (2) context.details | ||
| (1) Create UI Button; (2) Edit UI Button | Pre-validation | context.data | context.data | Does not support details | |
| Change Owner | Pre-validation | context.data | context.data | Does not support details | |
| Copy | Pre-validation | context.data | context.data | Does not support details | |
| Lock | (1) Pre-validation; (2) Post-action | context.data | context.data | Does not support details | |
| Unlock | (1) Pre-validation; (2) Post-action | context.data | context.data | Does not support details | |
| Void | Pre-validation | (1) context.data; (2) context.arg | context.data | Does not support details | |
| Post-action | (1) context.data; (2) context.details; (3) context.arg | (1) context.data; (2) context.details | |||
| (1) Pre-validation; (2) Post-action | context.data | context.data | Does not support details | ||
| Add Related Team Members | (1) Pre-validation; (2) Post-action | (1) context.data; (2) context.arg | (1) context.data; (2) context.arg | context.arg contains the submitted related team member data for addition. | |
| Edit Related Team Members | (1) Pre-validation; (2) Post-action | (1) context.data; (2) context.arg | (1) context.data; (2) context.arg | context.arg contains the submitted related team member data for editing. | |
| Remove Related Team Members | (1) Pre-validation; (2) Post-action | (1) context.data; (2) context.arg | (1) context.data; (2) context.arg | context.arg contains the submitted related team member data for removal. | |
| Workflow | - | - | (1) context.data; (2) context.details | (1) context.data; (2) context.details | Workflow functions created after February 24, 2024 no longer support context.details; using this field will result in an error. |
| Lookup Related Data Scope | Main Object - Lookup Field | - | context.data, main object data | context.data, main object data | |
| Sub-Object - Lookup Field | Create Main and Sub Together | (1) context.data, main object data; (2) context.details, currently triggered sub-object data | context.data, currently selected sub-object data | Debug behavior differs from normal runtime here. | |
| Create Sub Alone | context.data, current sub-object data | context.data, current sub-object data | Behavior consistent with creating main object alone. | ||
| Auto-numbering | Main Object - Auto-numbering Field | - | context.data | context.data | Does not support details |
| Sub-Object - Auto-numbering Field | - | context.data, current sub-object data | context.data, currently selected sub-object data | ||
| Scheduled Task | Bound to Object | - | context.objectIds, data IDs matching the criteria | context.objectIds, currently selected data IDs | |
| Not Bound to Object | - | - | - |
Differences in Empty Fields During Pre-validation/UI Events
- Web Client: Empty fields are empty strings
''. - Mobile Client/Server Side: Empty fields are
null.
Impact
When retrieving a field value during pre-validation/UI events, besides checking value != null, also check value != ''. Otherwise, you might retrieve '' causing subsequent logic errors.
Differences Between Debug and Normal Runtime
- context.details: Debug loads only 6 sub-object records; normal runtime loads full data.
