Authoritative Tutorial: Kingdee Cloud Department Query API Field Manual
What This Interface Solves
In Kingdee Cloud–DingTalk integration scenarios, department master data is the cornerstone of organization synchronization. The ExecuteBillQuery interface (FormId: BD_Department) on Kingdee Cloud queries department master data, providing a data source for Kingdee–DingTalk department mapping, employee affiliation mapping, and department selection in approval flows. This interface uses a pure query mode with an empty-write operation at the target end, and it commonly serves as a trusted data source for downstream synchronization strategies (such as pushing departments to DingTalk).
Interface Capability Overview
- Authentication: Based on Kingdee Cloud API gateway authentication, requiring valid app tickets and user tokens. The Qeasy adapter encapsulates the signing logic.
- Request Method: HTTP POST with a JSON body. The core parameter
FormIdis fixed asBD_Department. - Response Structure: Standard Kingdee Result response. Business data is wrapped in the
Result.Result.Resultsarray, where each row corresponds to one department record. - Pagination: Implemented via
Limit(rows per page),StartRow(starting index), andTopRowCount(total row count). Qeasy defaults to 2000 rows per page and automatically paginates and merges. - Incremental Mode: Uses audit-date-based incremental filtering. The FilterString looks like
FAuditDate>='{{LAST_SYNC_TIME|dateTime}}', combined with multi-organization filteringin ('04','0402','0401'). - Execution Cycle: Scheduled task runs every 2 hours (
* */2 * * *), aligning with the frequency of master data changes.
Typical Field Mapping
| Field Name | Type | Meaning | Practical Notes |
|---|---|---|---|
| FDEPTID | string | Department primary key, uniquely identifies a record | Configure as id in metadata; serves as the cross-system mapping anchor |
| FNumber | string | Department business code | Core key for cross-system mapping; recommend building a unique index with DingTalk department codes |
| FName | string | Department display name | Configure as number in metadata; used for business display |
| FUseOrgId | string | Using organization ID/code | Determines department visibility in multi-org scenarios; commonly used in filter conditions |
| FUseOrgId_FName | string | Using organization name | Display name of the associated object; facilitates validation during integration mapping |
| FCreateOrgId | string | Creating organization ID | Indicates the organization that owns the department; affects data isolation scope |
| FCreatorId | string | Creator ID | Audit field; traces department creation responsibility |
| FCreateDate | string | Creation date | Can serve as an auxiliary incremental condition, but FAuditDate is officially recommended |
| FGroup | string | Department group | Custom grouping by function or region; optional |
| FFullName | string | Department full name | Full path including parent, e.g., "Headquarters/Finance/Cost Group" |
In Qeasy's field mapper, these fields are automatically registered as draggable source fields. Engineers only need to draw lines between "Kingdee field → DingTalk field" on the canvas.
How to Configure on Qeasy
Qeasy provides deep encapsulation of the Kingdee Cloud ExecuteBillQuery interface. The configuration steps are as follows:
- Adapter Selection: Choose the "Kingdee Cloud" adapter in the data source configuration and fill in the service URL, app ID, and secret.
- Form ID: Enter
BD_Department. Qeasy will automatically pull the metadata and field list for this form. - Primary Key and Code Fields: In the metadata configuration, point
idtoFDEPTIDandnumbertoFName. Qeasy generates the mapping relationship accordingly. - Incremental Filtering: Use the
{{LAST_SYNC_TIME|dateTime}}placeholder in the FilterString template. Qeasy automatically replaces it with the last successful sync time on each run. - Empty-Write Target: Select QUERY as the strategy type and configure the target end as "empty write operation." Query results are only cached in the Qeasy data middle platform for downstream strategy consumption.
- Scheduled Task: Configure crontab as
* */2 * * *. The Qeasy scheduler pulls the latest data on schedule.
Cross-Scenario Practical Essentials
From multiple customer Kingdee–DingTalk integration solutions, we have distilled the following common experiences:
- Primary Key First: Always use
FDEPTIDas the cross-system unique identifier, notFName, because department names can be duplicated. - Code Alignment: Kingdee's
FNumberand DingTalk's department codes must be mapped one-to-one to avoid duplicate creation during downstream sync. - Multi-Organization Filtering: Always include
FUseOrgId.FNumber in (...)in the FilterString. Otherwise, all departments across the group will be pulled, causing data explosion. - Incremental Field Selection: Prefer
FAuditDateoverFModifyDatebecause the audit date is more stable; unapproved records should not flow downstream. - Pagination Cap: Kingdee's interface typically returns up to 2000 rows per call. Qeasy auto-paginates, but you still need to monitor whether the total row count is abnormal.
- Leverage Hierarchy Fields:
FFullNamecontains the complete path and can be directly used for hierarchical display in DingTalk organization structure without downstream stitching.
Pitfall Retrospective
- Filter Condition Failure: A customer once used
FUseOrgId.FNumberinstead ofFUseOrgIdin the FilterString, causing the multi-org filter to be ineffective and pulling all departments. The safe approach is to first use Qeasy's "Test Execution" to verify whether the returned row count matches expectations. - Incremental Time Drift:
{{LAST_SYNC_TIME|dateTime}}is replaced in UTC by default. If the Kingdee server is in UTC+8, an 8-hour deviation occurs. It is recommended to explicitly configure the timezone in Qeasy or useFAuditDate>='{{LAST_SYNC_TIME|dateTime:+08:00}}'. - Primary Key Conflict: Kingdee's
FDEPTIDmay be duplicated under multi-org scenarios. You need to combineFUseOrgIdto form a composite primary key; otherwise, downstream DingTalk departments will be overwritten. - Pagination Data Loss: Kingdee's interface may skip pages due to StartRow offset in concurrent scenarios. Qeasy's paginator handles idempotency, but it is still recommended to disable incremental mode during the first full sync and switch after completion.
- Empty Organization Name:
FUseOrgId_FNameis empty in some historical data. Integration mapping needs to handle null fallback; otherwise, DingTalk will display "undefined".
When to Use
This interface is suitable for organization synchronization between Kingdee Cloud and DingTalk (or the Qeasy middle platform), department mapping table maintenance, and employee affiliation mapping scenarios. If the business only needs a one-time full export, it is recommended to use the Kingdee backend export directly; if continuous incremental synchronization is needed, ExecuteBillQuery + Qeasy QUERY mode is the most reliable combination.