English
CRM API
About 1413 wordsAbout 5 min
2026-01-09
This document consolidates the original CRMAPI.md and BomAPI.md. Use this file as the source of truth.
Entry Functions
Fx.crm.getProduct
Product-related entry.
Fx.crm.getProduct()
Reference interface:
Owner: Sun Deyu
Fx.crm.getLeads
Leads-related entry.
Fx.crm.getLeads()
Reference interface:
Owner: Gong Chunru
Fx.crm.getAccount
Account-related entry.
Fx.crm.getAccount()
Reference interface:
Owner: Li Kun (bruce)
Fx.crm.getBom
BOM-related entry.
Fx.crm.getBom()
Reference interface:
Fx.crm.getEnterpriseByName
Fuzzy query business registration information by company name.
Fx.crm.getEnterpriseByName(<String companyName>)
Parameters
Input format
| Parameter | Type | Description | Required |
|---|---|---|---|
| companyName | String | Company name, unified social credit code, or registration number | Yes |
Output format
| Parameter | APIResult | Description |
|---|---|---|
| isError | boolean | Whether an error occurred |
| data | List | Returned data |
| message | string | Message |
Groovy example
def(Boolean error, List data, String errorMessage) = Fx.crm.getEnterpriseByName("Baidu")Fx.crm.getEnterpriseDetailById
Query business registration information by companyId.
Fx.crm.getEnterpriseDetailById(<String companyId>)
Parameters
Input format
| Parameter | Type | Description | Required |
|---|---|---|---|
| companyId | String | Company ID | Yes |
Groovy example
def(Boolean error, Map data, String errorMessage) = Fx.crm.getEnterpriseDetailById("1644990310")Fx.crm.automatch
Automatic write-off API.
Fx.crm.automatch(<String objectDescribeApiName>, <String objectDataId>)
Parameters
Input format
| Parameter | Type | Description | Required |
|---|---|---|---|
| objectDescribeApiName | String | Object API Name | Yes |
| objectDataId | String | Object ID | Yes |
Output format
| Parameter | APIResult | Description |
|---|---|---|
| isError | boolean | Whether an error occurred |
| data | Map | Returned data |
| message | string | Message |
Output example
{
"isError": false,
"data": {},
"message": "success"
}Groovy example
String objectDescribeApiName = "PaymentObj"
String objectDataId = "1111"
def(boolean error, Map data, String message) = Fx.crm.automatch(objectDescribeApiName, objectDataId)
if (error) {
log.info("error: " + message)
} else {
log.info(data)
}Notes
- This API currently supports only scenarios where automatic write-off is enabled.
Fx.crm.bankStatement.identifyAccount
Identify account from bank statements.
Fx.crm.bankStatement.identifyAccount(<List objectIds>)
Parameters
Input format
| Parameter | Type | Description | Required |
|---|---|---|---|
| objectIds | List | Bank statement ID list | Yes |
Output format
| Parameter | APIResult | Description |
|---|---|---|
| isError | boolean | Whether an error occurred |
| data | Map | Returned data |
| message | string | Message |
Output example
{
"isError": false,
"data": {},
"message": "success"
}Groovy example
List<String> objectIds = ["1111"]
def(boolean error, Map data, String message) = Fx.crm.bankStatement.identifyAccount(objectIds)
if (error) {
log.info("error: " + message)
} else {
log.info(data)
}Notes
- This API currently supports only scenarios where payment matching is enabled.
Fx.crm.periodicAccountsReceivable
Periodic receivable generation.
Fx.crm.periodicAccountsReceivable(<String masterDescribeApiName>, <String detailDescribeApiName>, <String detailDataId>)
Parameters
Input format
| Parameter | Type | Description | Required |
|---|---|---|---|
| masterDescribeApiName | String | Parent object API Name | Yes |
| detailDescribeApiName | String | Child object API Name | Yes |
| detailDataId | String | Child object ID | Yes |
Output format
| Parameter | APIResult | Description |
|---|---|---|
| isError | boolean | Whether an error occurred |
| data | Map | Returned data |
| message | string | Message |
Output example
{
"isError": false,
"data": {},
"message": "success"
}Groovy example
String masterDescribeApiName = "SalesOrderObj"
String detailDescribeApiName = "SalesOrderProductObj"
String detailDataId = "1111"
def(boolean error, Map data, String message) = Fx.crm.periodicAccountsReceivable(
masterDescribeApiName,
detailDescribeApiName,
detailDataId
)
if (error) {
log.info("error: " + message)
} else {
log.info(data)
}Notes
- This API currently supports only scenarios where periodic receivable generation is enabled.
ProductAPI
shelf
Put product on shelf / off shelf.
Fx.crm.product.shelf(<String productId>, <Integer status>)
Parameters
Input format
| Parameter | Type | Description | Required |
|---|---|---|---|
| productId | String | Product ID | Yes |
| status | Integer | 1 on shelf, 2 off shelf | Yes |
Groovy example
def (Boolean err, Map data, String errorMessage) = Fx.crm.product.shelf("e1e145095f8142c891802fa36fcbd4c6", 1)
def (Boolean err2, Map data2, String errorMessage2) = Fx.crm.product.shelf("e1e145095f8142c891802fa36fcbd4c6", 2)createProductCategory
Create product category.
Fx.crm.product.createProductCategory(<String name>, <String categoryCode>, <String pid>)
Parameters
Input format
| Parameter | Type | Description | Required |
|---|---|---|---|
| name | String | Product category name | Yes |
| categoryCode | String | Product category code | Yes |
| pid | String | Parent category ID | No |
deleteProductCategory
Delete product category.
Fx.crm.product.deleteProductCategory(<String id>)
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| id | String | Product category ID | Yes |
updateProductCategory
Update product category.
Fx.crm.product.updateProductCategory(<String id>, <Map arg>)
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| id | String | Product category ID | Yes |
| arg | Map | Updated category content | Yes |
searchCategory
Search category records by field value.
Fx.crm.product.searchCategory(<String fieldApiName>, <List values>)
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| fieldApiName | String | Category field API Name, supports category_code | Yes |
| values | List | Field value list, up to 20 values | Yes |
associateAttribute
Associate product attributes.
Fx.crm.product.associateAttribute(<List productIds>, <List attributeIds>)
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| productIds | List | Product ID array | Yes |
| attributeIds | List | Attribute ID array | Yes |
disAssociateAttribute
Disassociate product attributes.
Fx.crm.product.disAssociateAttribute(<List productIds>, <List attributeIds>)
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| productIds | List | Product ID array | Yes |
| attributeIds | List | Attribute ID array | Yes |
LeadsAPI
move
Move lead.
Fx.crm.leads.move(<String leadsId>, <String leadsPoolId>)
| Parameter | Type | Description | Required |
|---|---|---|---|
| leadsId | String | Lead ID | Yes |
| leadsPoolId | String | Lead pool ID | Yes |
giveBack
Return lead.
Fx.crm.leads.giveBack(<String leadsIds>, <String leadsPoolId>, <String backReason>, <String otherReason>)
| Parameter | Type | Description | Required |
|---|---|---|---|
| leadsIds | String | Lead ID | Yes |
| leadsPoolId | String | Lead pool ID | Yes |
| backReason | String | Return reason option value, default return by function | No |
| otherReason | String | Extra note when backReason is other | No |
allocate
Allocate leads.
Fx.crm.leads.allocate(<List leadsIds>, <String leadsPoolId>, <String ownerld>)
| Parameter | Type | Description | Required |
|---|---|---|---|
| leadsIds | List[String] | Lead ID list | Yes |
| leadsPoolId | String | Lead pool ID | Yes |
| ownerld | String | User ID | Yes |
takeBack
Take back leads.
Fx.crm.leads.takeBack(<List leadsIds>, <String leadsPoolId>)
| Parameter | Type | Description | Required |
|---|---|---|---|
| leadsIds | List[String] | Lead ID list | Yes |
| leadsPoolId | String | Lead pool ID | Yes |
transfer
Lead conversion (one lead to three business entities).
Fx.crm.leads.transfer(<Boolean combineCRMFeed>, <Boolean putTeamMembersIntoCustomer>, <String leadsId>, <Map account>, <Map contact>, <Map newObjectData>, <Map opportunity>)
| Parameter | Lead conversion argument | Description | Required |
|---|---|---|---|
| combineCRMFeed | Boolean | Bring lead CRM feed into account automatically | Yes |
| putTeamMembersIntoCustomer | Boolean | Bring lead related team into account automatically | Yes |
| leadsId | String | Lead ID | Yes |
| account | Map | Account map. If _id exists, associate existing account; otherwise create a new one | Yes |
| contact | Map | Contact map | Yes |
| newObjectData | Map | Wrapper containing new Opportunity 2.0 data | Yes |
| opportunity | Map | Opportunity map | Yes |
| newObjectData | Type | Description | Required |
|---|---|---|---|
| object_data | object | Opportunity 2.0 payload | No |
AccountAPI
move
Move account to high seas.
Fx.crm.account.move(<String accountId>, <String highSeaId>)
| Parameter | Type | Description | Required |
|---|---|---|---|
| accountId | String | Account ID | Yes |
| highSeaId | String | High-seas ID | Yes |
Output format
| Parameter | APIResult | Description |
|---|---|---|
| error | Boolean | Whether an error occurred |
| data | String | Returned data |
| message | String | Message |
remove
Remove account from high seas.
Fx.crm.account.remove(<String accountId>, <String highSeaId>, <String owner>)
| Parameter | Type | Description | Required |
|---|---|---|---|
| accountId | String | Account ID | Yes |
| highSeaId | String | High-seas ID | Yes |
| owner | String | Owner ID | Yes |
giveBack
Give back account to high seas.
Fx.crm.account.giveBack(<String accountId>, <String highSeaId>, <String backReason>, <String otherReason>)
| Parameter | Type | Description | Required |
|---|---|---|---|
| accountId | String | Account ID | Yes |
| highSeaId | String | High-seas ID | Yes |
| backReason | String | Return reason option value, default return by function | No |
| otherReason | String | Extra note when backReason is other | No |
takeOut
Take out account.
Fx.crm.account.takeOut(<List accountIds>)
| Parameter | Type | Description | Required |
|---|---|---|---|
| accountIds | List | Account ID list | Yes |
allocate
Allocate account.
Fx.crm.account.allocate(<List accountIds>, <String highSeaId>, <String ownerId>)
| Parameter | Type | Description | Required |
|---|---|---|---|
| accountIds | List | Account ID list | Yes |
| highSeaId | String | High-seas ID | Yes |
| ownerId | String | User ID | Yes |
takeBack
Take back account.
Fx.crm.account.takeBack(<List accountIds>, <String highSeaId>)
| Parameter | Type | Description | Required |
|---|---|---|---|
| accountIds | List | Account ID list | Yes |
| highSeaId | String | High-seas ID | Yes |
BomAPI
bomDeploy
Save product configuration details.
Fx.crm.bom.bomDeploy(<String rootProductId>, <List nodeList>, <List deletedBomAndGroupList>)
| Parameter | Type | Description | Required |
|---|---|---|---|
| rootProductId | String | Root product ID | Yes |
| nodeList | List | Array of created/updated nodes | No |
| deletedBomAndGroupList | List | Array of deleted nodes | No |
Output format
| Parameter | APIResult | Description |
|---|---|---|
| isError | boolean | Whether an error occurred |
| data | Map | Returned data |
| message | string | Message |
add
Create product combination.
Fx.crm.bom.add(<Map objectData>, <Map details>)
| Parameter | Type | Description | Required |
|---|---|---|---|
| objectData | Map | Parent object field values | |
| details | Map | Child object data |
Output format
| Parameter | APIResult | Description |
|---|---|---|
| isError | boolean | Whether an error occurred |
| data | Map | Returned data |
| message | string | Message |
Notes
childrenrepresents child nodes of the current node.
edit
Edit product combination.
Fx.crm.bom.edit(<Map objectData>, <Map details>)
| Parameter | Type | Description | Required |
|---|---|---|---|
| objectData | Map | Parent object field values | Yes |
| details | Map | Child object data | Yes |
Output format
| Parameter | APIResult | Description |
|---|---|---|
| isError | boolean | Whether an error occurred |
| data | Map | Returned data |
| message | string | Message |
Notes
childrenrepresents child nodes of the current node.action_typerepresents operation type:create,update, ordelete.
queryBomTree
Get complete product combination structure.
Fx.crm.bom.queryBomTree(<bom_core_id>, <need_sub_bom>, <bom_amount>, <include_all>)
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| bom_core_id | String | Product combination ID | Yes |
| need_sub_bom | Boolean | Whether to return sub-BOM data | No |
| bom_amount | Integer | Amount of BOM package, default is 1 | No |
| include_all | Boolean | If group is deleted, whether to include children under that group, default is false | No |
Output format
| Parameter | APIResult | Description |
|---|---|---|
| isError | boolean | Whether an error occurred |
| data | List | Returned child data |
| message | String | Message |
Output example
{
"isError": false,
"data": {},
"message": "success"
}Groovy example
Integer amount = 1
def(boolean error, Object data, String message) = Fx.crm.bom.queryBomTree(
"67ee3216cf9d1b00014a4af5",
true,
amount,
false
)
Map map = Fx.json.parseObject(data as String, Map)
List result = map["dataMapList"] as List