Fx.crm: APIs related to CRM operations
1. Products
Fx.crm.getProduct()
return type
ProductAPI
(1). Reference ProductAPI
2. Clues
Fx.crm.getLeads()
return type
Leads API
(1). Refer to LeadsAPI
3. Customers
Fx.crm.getAccount()
return type
AccountAPI
(1).Refer to AccountAPI
4. Fuzzy query of industrial and commercial information through company name
Fx.crm.getEnterpriseByName(<String companyName>)
Parameter Description
| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| companyName | String | Company Name |
return type
APIResult
Return value description
List
Java example
APIResult ret = Fx.crm.getEnterpriseByName("Baidu");
if (ret. isError()) {
log.info(ret.message());
} else {
log.info(ret.getData());
}
Groovy example
def(Boolean error, List data, String errorMessage) = Fx.crm.getEnterpriseByName("Baidu")
5. Query business information through companyId
Fx.crm.getEnterpriseDetailById(<String companyId>)
Parameter Description
| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| companyId | String | |
return type
APIResult
Return value description
Map
Java example
APIResult ret = Fx.crm.getEnterpriseDetailById("1644990310");
if (ret. isError()) {
log.info(ret.message());
} else {
log.info(ret.getData());
}
Groovy example
def(Boolean error, Map data, String errorMessage) = Fx.crm.getEnterpriseDetailById("1644990310")
Reference class com.fxiaoke.functions.api.ProductAPI
1. Product on and off shelves
shelf(<String productId>, <Integer status>)
Parameter Description
| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| productId| String | product id |
| status | Integer | status = 1 put on the shelf, status = 2 off the shelf |
return type
APIResult
Return value description
Map
Java example
APIResult ret = Fx.crm.getProduct().shelf("e1e145095f8142c891802fa36fcbd4c6", 1); //shelf product
APIResult ret1 = Fx.crm.getProduct().shelf("e1e145095f8142c891802fa36fcbd4c6", 2); //Remove the product
Groovy example:
def (Boolean err,Map data,String errorMessage) = Fx.crm.product.shelf("e1e145095f8142c891802fa36fcbd4c6", 1) //shelf product
def (Boolean err,Map data,String errorMessage) = Fx.crm.product.shelf("e1e145095f8142c891802fa36fcbd4c6",2) //remove the product
2. Create product categories
createProductCategory(<String name>, <String categoryCode>, <String pid>)
Parameter Description
| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| name | String | product category name |
| categoryCode | String | product category code |
| pid | String | parent product Id |
return type
APIResult
Return value description
Map
Java example
APIResult ret = Fx.crm.getProduct().createProductCategory("Product Category Name", "Product Category Code", null);
APIResult ret1 = Fx.crm.getProduct().createProductCategory("Product Category Name","Product Category Code","123");
Groovy example:
def (Boolean err,Map data,String errorMessage) = Fx.crm.product.createProductCategory("Product Category Name", "Product Category Code", null)
def (Boolean err,Map data,String errorMessage) = Fx.crm.product.createProductCategory("Product Category Name", "Product Category Code", "123")
3. Delete product category
deleteProductCategory(<String id>)
Parameter Description
| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| id | String | product category id|
return type
APIResult
Return value description
Map
Java example
APIResult ret = Fx.crm.getProduct().deleteProductCategory("d23r23fc234143jhsuad");
if (ret. isError()) {
log.info(ret.message());
} else {
log.info(ret.getData());
}
Groovy example:
def res = (((Fx.object.find("ProductCategoryObj",[["category_code":"111"]], 10, 0)[1]) as QueryResult).dataList[0] as Map)
def id = (res._id) as String
def (Boolean error,Map data,String errorMessage) = Fx.crm.product.deleteProductCategory(id)
log. info(data)
4. Modify product classification
updateProductCategory(<String id>, <Map arg>)
Parameter Description
| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| id | String | product category id |
| arg | Map | Update product category content |
return type
APIResult
Return value description
Map
Java example
Map<String, Object>map = Maps. newHashMap();
map. put("name", "111");
map. put("categoryCode", "222");
APIResult ret = Fx.crm.getProduct().updateProductCategory("d23r23fc234143", map);
if (ret. isError()) {
log.info(ret.message());
} else {
log.info(ret.getData());
}
Groovy example:
def res = (((Fx.object.find("ProductCategoryObj",[["category_code":"111"]], 10, 0)[1]) as QueryResult).dataList[0] as Map)
def id = (res._id) as String
Map map = ["name":"111","categoryCode":"222"]
//Fix the product category
def (boolean err,Map dataList,String errorMessage) = Fx.crm.product.updateProductCategory(id,map)
Reference class com.fxiaoke.functions.api.LeadsAPI
1. Clue transfer
move(<String leadsId>, <String leadsPoolId>)
Parameter Description
| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| leadsId | String | leadsId|
| leadsPoolId | String | lead pool Id |
return type
APIResult
Return value description
String
Java example
APIResult ret = Fx.crm.getLeads().move("05f3f656feb9496abaa4cf50f1fa22ce", "85f454b044894f83a57e1bacfd2f1beb");
if (ret. isError()) {
log.info(ret.message());
} else {
log.info(ret.getData());
}
Groovy example:
def (Boolean err,String data,String errorMessage) = Fx.crm.leads.move("05f3f656feb9496abaa4cf50f1fa22ce", "85f454b044894f83a57e1bacfd2f1beb")
2. Lead returned
giveBack(<String leadsId>, <String leadsPoolId>)
Parameter Description
| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| leadsId | String | leadsId |
| leadsPoolId | String | lead pool Id |
return type
APIResult
Return value description
String
Java example
APIResult ret = Fx.crm.getLeads().giveBack("05f3f656feb9496abaa4cf50f1fa22ce", "85f454b044894f83a57e1bacfd2f1beb");
if (ret. isError()) {
log.info(ret.message());
} else {
log.info(ret.getData());
}
Groovy example:
Fx.crm.leads.giveBack("05f3f656feb9496abaa4cf50f1fa22ce", "85f454b044894f83a57e1bacfd2f1beb")
3. Lead distribution
allocate(<List accountIds>, <String leadsPoolId>, <String ownerId>)
Parameter Description
| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| accountIds | List | Lead Id list |
| leadsPoolId | String | lead pool Id |
| ownerId | String | user id |
return type
APIResult
Return value description
String
Java example
APIResult ret = Fx.crm.getLeads().allocate(Lists.newArrayList("3ed01dcafbe4402d99d7a521aaa4e9c3"), "85f454b044894f83a57e1bacfd2f1beb", "1025");
if (ret. isError()) {
log.info(ret.message());
} else {
log.info(ret.getData());
}
Groovy example:
Fx.crm.leads.allocate(["3ed01dcafbe4402d99d7a521aaa4e9c3"], "85f454b044894f83a57e1bacfd2f1beb", "1025")
4. Lead retraction
takeBack(<List accountIds>, <String leadsPoolId>)
Parameter Description
| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| accountIds | List | Lead Id list |
| leadsPoolId | String | lead pool Id |
return type
APIResult
Return value description
String
Java example
APIResult ret = Fx.crm.getLeads().takeBack(Lists.newArrayList("3ed01dcafbe4402d99d7a521aaa4e9c3"), "85f454b044894f83a57e1bacfd2f1beb");
if (ret. isError()) {
log.info(ret.message());
} else {
log.info(ret.getData());
}
Groovy example:
Fx.crm.leads.takeBack(["3ed01dcafbe4402d99d7a521aaa4e9c3"], "85f454b044894f83a57e1bacfd2f1beb")
5. Clue one to three
transfer(<Boolean combineCRMFeed>, <Boolean putTeamMembersIntoCustomer>, <String leadsId>, <Map account>, <Map contact>, <Map newOpportunity>, <Map opportunity>)
Parameter Description
| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| combineCRMFeed | Boolean | The sales records of sales leads are automatically brought into customers |
| putTeamMembersIntoCustomer | Boolean | The relevant team of the sales lead is automatically brought into the customer |
| leadsId | String | id of the sales lead |
| account | Map | Map of customers, if _id exists, associate old customers, if id does not exist, create new customers|
| contact | Map | Map converted into contacts |
| newOpportunity | Map | Data converted to Opportunity 2.0 |
| opportunity | Map | Data converted into opportunities |
return type
APIResult
Java example
String leadsId = "05f3f656feb9496abaa4cf50f1fa22ce";
Map<String, Object>account = Maps. newHashMap();
account.put("object_describe_api_name", "AccountObj");
account. put("record_type", "default__c");
account. put("created_by", Lists. newArrayList("1109"));
account. put("name", "hello");
Map<String, Object>contact = Maps. newHashMap();
Map<String, Object>newOpportunity = Maps. newHashMap();
Map<String, Object>opportunity = Maps. newHashMap();
APIResult ret = Fx.crm.getLeads().transfer(true, true, leadsId, account, contact, newOpportunity, opportunity);
if (ret. isError()) {
log.info(ret.message());
} else {
log.info(ret.getData());
}
Groovy example:
String leadsId = "05f3f656feb9496abaa4cf50f1fa22ce"
Map account = [
"object_describe_api_name": "AccountObj",
"record_type": "default__c",
"created_by": [
"1109"
],
"name": "hello"
]
Map contact = [:]
Map newOpportunity = [:]
Map opportunity = [:]
def(boolean error, Object data, String msg) = Fx. crm. leads. transfer(true, true, leadsId, account, contact, newOpportunity, opportunity)
if (error) {
log. info(data)
} else {
log. info(msg)
}
Reference class com.fxiaoke.functions.api.AccountAPI
1. Customer transfer to high seas
move(<String accountId>, <String highSeaId>)
Parameter Description
| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| accountId | String | AccountId |
| highSeaId | String | high sea Id |
return type
APIResult
Return value description
StringJava example
APIResult ret = Fx.crm.getAccount().move("ad14bbbcede240a48dc2f65787a8763d","6c1a6a54617245fe90aae5a162eb191d");
if (ret. isError()) {
log.info(ret.message());
} else {
log.info(ret.getData());
}
Groovy example:
Fx.crm.account.move("ad14bbbcede240a48dc2f65787a8763d","6c1a6a54617245fe90aae5a162eb191d")
2. Client removed from high seas
remove(<String accountId>, <String highSeaId>, <String owner>)
Parameter Description
| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| accountId | String | AccountId |
| highSeaId | String | high sea Id |
| owner | String | ID of the person in charge |
return type
APIResult
Return value description
String
Java example
APIResult ret = Fx.crm.getAccount().remove("ad14bbbcede240a48dc2f65787a8763d","6c1a6a54617245fe90aae5a162eb191d","1000");
if (ret. isError()) {
log.info(ret.message());
} else {
log.info(ret.getData());
}
Groovy example:
Fx.crm.account.remove("ad14bbbcede240a48dc2f65787a8763d","6c1a6a54617245fe90aae5a162eb191d","1000")
3. The client returns to the high seas
giveBack(<String accountId>, <String highSeaId>)
Parameter Description
| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| accountId | String | AccountId |
| highSeaId | String | high sea Id |
return type
APIResult
Return value description
String
Java example
APIResult ret = Fx.crm.getAccount().giveBack("ad14bbbcede240a48dc2f65787a8763d","6c1a6a54617245fe90aae5a162eb191d");
if (ret. isError()) {
log.info(ret.message());
} else {
log.info(ret.getData());
}
Groovy example:
Fx.crm.account.giveBack("ad14bbbcede240a48dc2f65787a8763d","6c1a6a54617245fe90aae5a162eb191d")
4. Customer pick up
takeOut(<List accountIds>)
Parameter Description
| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| accountIds | List | Customer Id list |
return type
APIResult
Return value description
String
Java example
APIResult ret = Fx.crm.getAccount().takeOut(Lists.newArrayList("ad14bbbcede240a48dc2f65787a8763d", "6c1a6a54617245fe90aae5a162eb191d"));
if (ret. isError()) {
log.info(ret.message());
} else {
log.info(ret.getData());
}
Groovy example:
Fx.crm.account.takeOut(["ad14bbbcede240a48dc2f65787a8763d", "6c1a6a54617245fe90aae5a162eb191d"])
5. Customer Assignment
allocate(<List accountIds>, <String highSeaId>, <String ownerId>)
Parameter Description
| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| accountIds | List | Customer Id list |
| highSeaId | String | high sea Id |
| ownerId | String | userId |
return type
APIResult
Return value description
String
Java example
APIResult ret = Fx.crm.getAccount().allocate(Lists.newArrayList("cd097b120f584533b627c40239ece7d0"),"0ebc054e55254b8b89f09d7ac7602972","1025");
if (ret. isError()) {
log.info(ret.message());
} else {
log.info(ret.getData());
}
Groovy example:
Fx.crm.account.allocate(["cd097b120f584533b627c40239ece7d0"],"0ebc054e55254b8b89f09d7ac7602972","1025")
6. Customer withdrawal
takeBack(<List accountIds>, <String highSeaId>)
Parameter Description
| parameter | type | description |
|------------ | ------------ | --------------------- --------------------------------------- |
| accountIds | List | Customer Id list |
| highSeaId | String | high sea Id |
return type
APIResult
Return value description
String
Java example
APIResult ret = Fx.crm.getAccount().takeBack(Lists.newArrayList("cd097b120f584533b627c40239ece7d0"),"0ebc054e55254b8b89f09d7ac7602972");
if (ret. isError()) {
log.info(ret.message());
} else {
log.info(ret.getData());
}
Groovy example:
Fx.crm.account.takeBack(["cd097b120f584533b627c40239ece7d0"],"0ebc054e55254b8b89f09d7ac7602972")