Fx.object

Fx.object:和对象操作有关的API 和对象操作有关的API

1. 对象创建同时新建从对象

Fx.object.create(<String apiName>, <Map objectData>, <Map details>, <ActionAttribute attribute>)

参数说明

参数 类型 说明
apiName String 对象的api名称
objectData Map 主对象数据即字段值
details Map 从对象数据
attribute ActionAttribute triggerApprovalFlow:是否触发审批流
triggerWorkflow:是否触发工作流
skipFunctionAction:是否跳过前验证函数,默认为false
specifyCreatedBy:默认的创建人是系统,通过参数指定在objectData中设置指定的key: < created_by:List > 传入人员的id可以设置创建人
specifyTime:指定创建时间,默认的创建时间是当前时间,通过指定参数可以在objectData中设置指定的key:create_time,可以设置创建时间,时间的格式是毫秒时间戳
duplicateSearch:在对象开启查重的情况下是否进行查重,默认为true
skipAfterFunction:是否跳过后动作函数,默认为false

返回值类型

APIResult

返回值说明

data数据类型 Map

Java举例

ActionAttribute attribute = ActionAttribute.create();
attribute.setTriggerApprovalFlow(false);
attribute.setTriggerWorkflow(false);
attribute.setSkipFunctionAction(true);
attribute.setSpecifyCreatedBy(true);
attribute.setSpecifyTime(true);
attribute.setDuplicateSearch(false);

APIResult result = Fx.object.create(
 "object_master__c", // apiName
 Maps.of("name", "主从同时新建"), //主对象
 Maps.of(
     "object_detail1__c",Lists.newArrayList( // 从对象
             Maps.of("name", "张三1", "customFiled__c", "test1"),
             Maps.of("name", "李四1", "customField__c", "test2")),
     "object_detail2__c", Lists.newArrayList(
             Maps.of("name", "张三2", "customFiled__c", "test1"),
             Maps.of("name", "李四2", "customField__c", "test2"))
), attribute);

if(result.isError()){
     log.info(result.message());
 }else{
     log.info(result.getData());
 }

Groovy举例

ActionAttribute attribute = ActionAttribute.build {
   triggerApprovalFlow = false
   triggerWorkflow = false
   skipFunctionAction = true
   specifyCreatedBy = true
   specifyTime = true
   duplicateSearch = false
}
 //主从同时新建,一个主对象,两个从对象数据
def(Boolean error,Map data,String errorMessage) = Fx.object.create(
      "object_master__c", // apiName
      ["name":"主从同时新建"], //主对象
      [ // 从对象
         "object_detail1__c":[["name":"张三1","customFiled__c":"test1"],["name":"李四1","customField__c":"test2"]],
         "object_detail2__c":[["name":"张三2","customFiled__c":"test1"],["name":"李四2","customField__c":"test2"]]
      ],
      attribute)

//只创建一个对象
def(Boolean error,Map data,String errorMessage) = Fx.object.create("object_master__c",["name":"只创建主"],null,attribute)

注意事项

  • details不传或者空既没有从对象

2. 批量创建数据

Fx.object.batchCreate(<String apiName>, <List objects>, <boolean triggerWorkflow>)

参数说明

参数 类型 说明
apiName String 对象的api名称
objects List 对象数据即字段值
triggerWorkflow boolean 可选参数,是否触发工作流,默认为false

返回值类型

APIResult

返回值说明

data数据类型 List

Java举例

Fx.object.batchCreate(
     "AccountObj",
     Lists.newArrayList(Maps.of("name", "客户1"), Maps.of("name", "客户2")),
     true);

Groovy举例

def(Boolean error, List data, String errorMessage) = Fx.object.batchCreate("AccountObj",[["name":"客户1"],["name":"客户2"]],true)

注意事项

  • 预设对象不推荐使用这个API批量创建。
  • 批量创建不会触发对象业务逻辑(判断权限、触发审批流等),是否触发工作流由参数控制。

3. 更新数据对象

Fx.object.update(<String apiName>, <String objectId>, <Map updateFields>, <boolean triggerWorkFlow>, <boolean duplicatedSearch>)

参数说明

参数 类型 说明
apiName String 对象的api名称
objectId String 数据ID
updateFields Map 对象数据即字段值
triggerWorkFlow boolean 可选参数,是否触发工作流,默认是true,触发工作流
duplicatedSearch boolean 可选参数,是否执行查重,默认是false,不执行查重

返回值类型

APIResult

返回值说明

data数据类型 Map

Java举例

APIResult result = Fx.object.update("AccountObj", "id123456", Maps.of("name", "纷享销客"), false, false);

Groovy举例

def (Boolean error,Map data,String errorMessage) =  Fx.object.update("AccountObj","id123456",["name":"纷享销客"],false)

4. 主从覆盖更新

Fx.object.update(<String apiName>, <String objectId>, <Map updateFields>, <Map detailData>, <ActionAttribute actionAttribute>)

参数说明

参数 类型 说明
apiName String 对象的api名称
objectId String 对象数据即字段值
updateFields Map 对象数据即字段值
detailData Map 从对象数据
actionAttribute ActionAttribute 可选参数
triggerApprovalFlow:是否触发审批流
triggerWorkflow:是否触发工作流
skipFunctionAction:是否跳过前验证函数,默认为false
specifyCreatedBy:默认的创建人是系统,通过参数指定在objectData中设置指定的key: < created_by:List > 传入人员的id可以设置创建人
duplicateSearch:在对象开启查重的情况下是否进行查重,默认为true
skipAfterFunction:是否跳过后动作函数,默认为false

返回值类型

APIResult

返回值说明

data数据类型 Map

Java举例

String objectApiName = "object_qs2nb__c";
String objectId = "607d5e3dd02b9f00016507d8";
Map objectMap = Maps.of("name", "校验");
Map detailMap = Maps.of("object_cDxt8__c", Maps.of("name", "我是从对象,我被函数更改了"));

ActionAttribute attribute = ActionAttribute.create();
attribute.setTriggerWorkflow(true);
attribute.setTriggerApprovalFlow(true);
attribute.setSkipFunctionAction(true);
attribute.setDuplicateSearch(false);
APIResult result = Fx.object.update(objectApiName, objectId, objectMap, detailMap, attribute);
if (result.isError()) {
    log.info(result.message());
} else {
    log.info(result.getData());
}

Groovy举例

String objectApiName = "object_qs2nb__c"
String objectId = "607d5e3dd02b9f00016507d8"
Map objectMap = ["name":"校验",]
Map detailMap = ["object_cDxt8__c":[["name": "我是从对象,我被函数更改了"]]]
ActionAttribute attribute = ActionAttribute.build {
     triggerApprovalFlow = true
     triggerWorkflow = true
     skipFunctionAction = false
     duplicateSearch = false
}
def (Boolean error,Map data,String errorMessage) = Fx.object.update(objectApiName,objectId,objectMap,detailMap,attribute)
if(error){
 log.info(errorMessage)
}else{
 log.info(data)
}

注意事项

  • 覆盖更新,如果传null或者空,则覆盖为null或者空
  • 如不想更新从对象,则detailData给null,如果传空,则清空从对象

5. 获取查重结果

Fx.object.duplicateSearch(<String apiName>, <String type>, <Map data>, <String relatedApiName>, <int pageNumber>, <int pageSize>)

参数说明

参数 类型 说明
apiName String 对象apiName
type String 查重类型,其中新建、编辑时为“NEW",查重工具时为"TOOL"
data Map 更新、新建数据
relatedApiName String 有查找关联关系的对象apiName(注:查本对象时不用传)
pageNumber int 显示页数
pageSize int 每页条数

返回值类型

APIResult

返回值说明

data数据类型 List

Java举例

Map data = Maps.newHashMap();
data.put("object_describe_api_name", "object_227xW__c");
data.put("field_rT3cG__c", "函数测试12");
APIResult result = Fx.object.duplicateSearch("object_227xW__c", "NEW", data, null, 1, 20);
if (result.isError()) {
 log.info(result.message());
} else {
 log.info(result.getData());
}

Groovy举例

Map data = ["object_describe_api_name":"object_227xW__c","field_rT3cG__c":"函数测试12"]
def(boolean error, Map ret, String errorMessage) = Fx.object.duplicateSearch("object_227xW__c", "NEW", data, null, 1, 20)
if (error) {
 log.info(errorMessage)
} else {
 log.info(ret)
}

6. 批量更新数据

Fx.object.batchUpdate(<String apiName>, <Map objects>)

参数说明

参数 类型 说明
apiName String 对象的api名称
objects Map 对象数据即字段值(key值为对象ID)

返回值类型

APIResult

返回值说明

data数据类型 List

Java举例

Map data = Maps.newHashMap();
data.put("e6a338ae8a944cdfb2bae737db1aa12f", Maps.of("name", "客户1"));
data.put("4cd5a9f902af4f66a34df35a53630237", Maps.of("name", "客户2"));
APIResult result = Fx.object.batchUpdate("AccountObj", data);

Groovy举例

def (Boolean error,List data,String errorMessage) = Fx.object.batchUpdate("AccountObj",["e6a338ae8a944cdfb2bae737db1aa12f":["name":"客户1"],"4cd5a9f902af4f66a34df35a53630237":["name":"客户2"]])

注意事项

  • 该函数不会触发对象业务逻辑(判断权限、触发审批流等)。

7. 批量更新某个字段的内容

Fx.object.batchUpdate(<String apiName>, <Map objects>, <List fields>)

参数说明

参数 类型 说明
apiName String 对象的api名称
objects Map 批量更新的数据信息
fields List 批量更新的字段里列表

返回值类型

APIResult

返回值说明

data数据类型 List

Java举例

Map batch = Maps.newHashMap();
batch.put("60acc4a2d040a70001886739", Maps.of("field_5h77a__c", "test1"));
batch.put("60acc482d040a70001886582", Maps.of("field_5h77a__c", "'test2'"));

List fields = Lists.newArrayList("field_5h77a__c");
APIResult result = Fx.object.batchUpdate("object_8N0H2__c", batch, fields);
if (result.isError()) {
   log.info(result.message());
} else {
   log.info(result.getData());
}

Groovy举例

Map batch = [ '60acc4a2d040a70001886739': [ 'field_5h77a__c': 'test1' ], '60acc482d040a70001886582': [ 'field_5h77a__c': 'test2' ] ] List fields = ['field_5h77a__c']
def (Boolean error,List data,String errorMessage) = Fx.object.batchUpdate('object_8N0H2__c', batch, fields)
if (error) {
 log.info(errorMessage)
} else {
 log.info(data)
}

注意事项

  • 该接口不会触发对象业务逻辑(如:判断权限、触发审批流等)。
  • fields里面指定的字段必须在objects里存在,如不存在,则表示清空。

8. FQL查询

Fx.object.find(<String apiName>, <FQLAttribute fqlAttribute>, <SelectAttribute selectAttribute>)

参数说明

参数 类型 说明
apiName String 对象ApiName
fqlAttribute FQLAttribute 查询条件,详细说明参考FQLAttribute对象
selectAttribute SelectAttribute 查询属性,非必填,详细说明参考SelectAttribute

返回值类型

APIResult

返回值说明

APIResult的data数据类型 : List

Groovy举例

APIResult ret = Fx.object.find("AccountObj", //查询客户对象
             FQLAttribute.builder()
                .columns(["_id", "name"]) //返回的数据id
                .queryTemplate( QueryTemplate.AND(["_id": QueryOperator.EQ("6177cde7a0cb410001930ad0")] ))
                .build(),
             SelectAttribute.builder()
                .build());
if(ret.isError()){
    log.info(ret.message());
}

log.info(ret.data)
(1).参考FQLAttribute
(2).参考SelectAttribute
(3).参考QueryOperator

9. FQL查询单条数据

Fx.object.findOne(<String apiName>, <FQLAttribute fqlAttribute>, <SelectAttribute selectAttribute>)

参数说明

参数 类型 说明
apiName String 对象ApiName
fqlAttribute FQLAttribute 查询条件,详细说明参考FQLAttribute对象
selectAttribute SelectAttribute 查询属性,非必填,详细说明参考SelectAttribute

返回值类型

APIResult

返回值说明

APIResult的data数据类型 : Map

Groovy举例

APIResult ret = Fx.object.findOne("AccountObj", //查询客户对象
             FQLAttribute.builder()
                .columns(["_id", "name"]) //返回的数据id
                .queryTemplate( QueryTemplate.AND(["_id": QueryOperator.EQ("6177cde7a0cb410001930ad0")] ))
                .build(),
             SelectAttribute.builder()
                .build());
if(ret.isError()){
    log.info(ret.message());
}

log.info(ret.data)
(1).参考FQLAttribute
(2).参考SelectAttribute
(3).参考QueryOperator

10. FQL查询单条数据Id

Fx.object.findById(<String apiName>, <String id>, <FQLAttribute fqlAttribute>, <SelectAttribute selectAttribute>)

参数说明

参数 类型 说明
apiName String 对象ApiName
id String 数据Id
fqlAttribute FQLAttribute 查询条件,详细说明参考FQLAttribute
selectAttribute SelectAttribute 查询属性,非必填,详细说明参考SelectAttribute

返回值类型

APIResult

返回值说明

APIResult的data数据类型 : Map

Groovy举例

APIResult ret = Fx.object.findById("AccountObj", //查询客户对象
             "6177cde7a0cb410001930ad0",
             FQLAttribute.builder()
                .columns(["_id","name"]) //返回的数据id
                .build(),
             SelectAttribute.builder()
                .build());
if(ret.isError()){
    log.info(ret.message());
}

log.info(ret.data)
(1).参考FQLAttribute
(2).参考SelectAttribute

11. FQL查询数据id匹配的数据集

Fx.object.findByIds(<String apiName>, <List ids>, <FQLAttribute fqlAttribute>, <SelectAttribute selectAttribute>)

参数说明

参数 类型 说明
apiName String 对象ApiName
ids List 数据Id列表
fqlAttribute FQLAttribute 查询条件,详细说明参考FQLAttribute
selectAttribute SelectAttribute 查询属性,非必填,详细说明参考SelectAttribute

返回值类型

APIResult

返回值说明

APIResult的data数据类型 : List

Groovy举例

APIResult ret = Fx.object.findByIds("AccountObj", //查询客户对象
             ["6177cde7a0cb410001930ad0"],
             FQLAttribute.builder()
                .columns(["_id","name"]) //返回的数据id
                .build(),
             SelectAttribute.builder()
                .build());
if(ret.isError()){
    log.info(ret.message());
}

log.info(ret.data)
(1).参考FQLAttribute
(2).参考SelectAttribute
(3).参考QueryOperator

12. 通过SQL语句查询数据,可以设置是否从db查询,是否查询总数,是否查相关团队等参数

Fx.object.select(<String sql>, <SelectAttribute selectAttribute>)

参数说明

参数 类型 说明
sql String 查询数据的sql语句
selectAttribute SelectAttribute 特殊查询条件,非必填

返回值类型

APIResult

返回值说明

APIResult的data数据类型 : QueryResult

Java举例

//普通用法
String sql = "select _id, field_rzv5M__c, name from object_227xW__c where field_rzv5M__c>100 limit 10 offset 0;";
APIResult rst = Fx.object.select(sql);
log.info(rst);

//如果需要查询不包含作废数据、返回满足条件的数据总数
String sql1 = "select _id, field_rzv5M__c, name from object_227xW__c where field_rzv5M__c>100 limit 10 offset 0;";
SelectAttribute att = SelectAttribute.builder();
  .needCount(true)
  .needInvalid(false)
  .build();
APIResult rst1 = Fx.object.select(sql1, att);
log.info(rst1);

Groovy举例

//普通用法
String sql = "select _id, field_rzv5M__c, name from object_227xW__c where field_rzv5M__c>100 limit 10 offset 0;"
def rst = Fx.object.select(sql)
log.info(rst)

//如果需要查询不包含作废数据、返回满足条件的数据总数
String sql1 = "select _id, field_rzv5M__c, name from object_227xW__c where field_rzv5M__c>100 limit 10 offset 0;"
SelectAttribute att = SelectAttribute.builder()
  .needCount(true)
  .needInvalid(false)
  .build()
def rst1 = Fx.object.select(sql1, att)
log.info(rst1)
(1).参考SelectAttribute

13. 使用queryTemplate实现或条件进行数据筛选

Fx.object.find(<String apiName>, <QueryTemplate queryTemplate>, <Map orderBy>, <int limit>, <int skip>, <FindAttribute attribute>)

参数说明

参数 类型 说明
apiName String 对象的api名称
queryTemplate QueryTemplate 查询条件queryTemplate
orderBy Map 排序规则 key:按哪个字段排序,字段名称 ;value:1 - 升序,-1 - 降序
limit int 限制查询条数,最大100条,如超过返回100条,使用skip参数分批查询
skip int 跳过多少数据
attribute FindAttribute 可选参数
useCurrentIdentity 是否使用当前用户身份查询数据(默认false)(之前是find的独立参数,整合到FindAttribute里,之前的写法兼容)
returnRelatedValue 是否返回相关数据id对应的value值(默认false)
forceQueryFromDB 是否从DB查询数据(默认false)
extendFieldApiNames 需要补充__r的字段apiName

返回值类型

APIResult

返回值说明

APIResult的data数据类型 QueryResult

Java举例

List apiNames = Lists.newArrayList("field_0us5a__c", "data_own_department");
        FindAttribute findAttribute = FindAttribute.getDefaultFindAttribute();
        findAttribute.setUseCurrentIdentity(true);
        findAttribute.setForceQueryFromDB(false);
        findAttribute.setExtendFieldApiNames(apiNames);

        //排序方式 1 - 升序,-1 - 降序
        Map order = Maps.of("name", 1);

//QueryTemplate使用OR条件需要单独开通,请联系销售人员下订单开通产品:【对象列表筛选支持或者】
QueryTemplate template = QueryTemplate.OR(template1, template2);

APIResult result = Fx.object.find("object_6177t__c", template ,order ,Maps.of("name", 1), 10, 0, findAttribute);
if(result.isError()){
     log.info(result.message());
} else {
     log.info(result.getData());
}

Groovy举例

QueryTemplate template1 = QueryTemplate.AND(["name": Operator.LIKE("测试")])
QueryTemplate template2 = QueryTemplate.AND(["field_99psr__c":Operator.EQ("78057")])
List apiNames = ["field_0us5a__c", "data_own_department"]
FindAttribute findAttribute = FindAttribute.builder()
     .useCurrentIdentity(true)
     .forceQueryFromDB(false)
     .extendFieldApiNames(apiNames)
     .build()

//QueryTemplate使用OR条件需要单独开通,请联系销售人员下订单开通产品:【对象列表筛选支持或者】
QueryTemplate template = QueryTemplate.OR(template1,template2)
def (Boolean error,QueryResult data,String errorMessage) = Fx.object.find("object_6177t__c", template, ["name":1], 10, 0, findAttribute)
if (error) {
     log.info(errorMessage)
} else {
     log.info(data)
}

注意事项

  • 查询数据会有延迟,如果对实时性要求很高,请指定从数据库查询(非实时场景谨慎使用,性能低)

14. 查询大量数据,并且需要进行翻页时使用

Fx.object.find(<String apiName>, <List searchCondition>, <Closure closure>, <String lastId>, <FindAttribute attribute>)

参数说明

参数 类型 说明
apiName String 对象的APIName
searchCondition List 查询条件
closure Closure 闭包,参考以下说明
lastId String 可选参数,最后一个数据id
attribute FindAttribute 可选参数
useCurrentIdentity 是否使用当前用户身份查询数据(默认false)(之前是find的独立参数,整合到FindAttribute里,之前的写法兼容)
returnRelatedValue 是否返回相关数据id对应的value值(默认false)
forceQueryFromDB 是否从DB查询数据(默认false)
extendFieldApiNames 需要补充__r的字段apiName

返回值类型

APIResult

Java举例

//java暂不支持闭包写法

Groovy举例

//一次返回closure中的数据最多为2W条,多于2W的场合需要利用返回值的lastId循环执行find函数
def closure  = {
     List list ->//循环聚合所有数据 100条为一批
     log.info(list);
}
def (Boolean error,PageQueryData data,String errorMessage) = Fx.object.find("object_eWv3k__c",[["data_own_department":"1000"]],closure);
if (error) {
     log.info(errorMessage)
} else {
     log.info(data)
}

注意事项

  • 条件中的日期格式使用毫秒时间戳
  • forceQueryFromDB为true时查询效率较低,建议数据实时性要求较高的场景下使用,如新建或更新数据后立刻需要调用find函数查询
  • 查询数据会有延迟,如果对实时性要求很高,请指定从数据库查询(非实时场景谨慎使用,性能低)

15. 该函数可以通过查找关联或主从关系,查询相关数据,并且一起返回

Fx.object.findWithRelated(<String apiName>, <String relatedField>, <List criteria>, <Map orderBy>, <int limit>, <int skip>, <ActionAttribute attribute>)

参数说明

参数 类型 说明
apiName String 主对象的api名称 / 从对象api名称
relatedField String 主对象的关联字段 / 从对象的主对象字段
criteria List 查找条件
orderBy Map 排序规则 key:按哪个字段排序,字段名称 ;value:1 - 升序,-1 - 降序
limit int 限制查询条数,最大100条,如超过返回100条,使用skip参数分批查询
skip int 跳过多少数据
attribute ActionAttribute 可选参数
triggerApprovalFlow:是否触发审批流
triggerWorkflow:是否触发工作流
skipFunctionAction:是否跳过前后动作函数,这个参数设置为true,前后动作的函数都会跳过
specifyTime:指定创建时间,默认的创建时间是当前时间,通过指定参数可以在objectData中设置指定的key:create_time,可以设置创建时间,时间的格式是毫秒时间戳
duplicateSearch:在对象开启查重的情况下是否进行查重,默认为true

返回值类型

APIResult

返回值说明

APIResult的data数据类型 :QueryResult

Java举例

APIResult result = Fx.object.findWithRelated(
       "object_0uyAd__c",
       "field_YjJ6d__c",
       Lists.newArrayList(Maps.of("_id", "60868215965b1900014c0d35")), Maps.newHashMap(), 1, 0);
if (result.isError()) {
   log.info(result.message());
} else {
   log.info(result.getData());
}
List dataList = (List) ((Map) result.getData()).get("dataList");
dataList.forEach(item ->{
   Map data = (Map) item;
   log.info(data.get("object_0uyAd__c"));//子对象
   log.info(data.get("AccountObj"));//主对象
});

Groovy举例

def (Boolean error,QueryResult data,String errorMessage) = Fx.object.findWithRelated('object_0uyAd__c', 'field_YjJ6d__c', [["_id":"60868215965b1900014c0d35"]], [:], 1, 0)
if (error) {
 log.info(errorMessage)
} else {
 log.info(data)
}
List dataList = data['dataList'] as List
dataList.each { item->log.info(item['object_0uyAd__c'])
 log.info(item['AccountObj'])
}

注意事项

  • 使用该函数做查找关联的时,ApiName给的是主对象的ApiName,并且relatedField是查找关联字段
  • 使用该函数做主从查询的时,ApiName给的是从对象的ApiName,并且relatedField是主对象字段

16. 作废业务对象

Fx.object.remove(<String apiName>, <String objectId>)

参数说明

参数 类型 说明
apiName String 对象的api名称
objectId String 对象实例的ID

返回值类型

APIResult

返回值说明

APIResult的data数据类型 Map

Java举例

APIResult result = Fx.object.remove("AccountObj", "ed47841898054749a2ec9be9e6e5d728");

Groovy举例

def (Boolean error,Map data,String errorMessage) =  Fx.object.remove("AccountObj","ed47841898054749a2ec9be9e6e5d728")

17. 批量作废

Fx.object.bulkRemove(<String apiName>, <List objectIds>, <ActionAttribute attribute>)

参数说明

参数 类型 说明
apiName String 对象APIName
objectIds List 数据id
attribute ActionAttribute 可选参数
triggerApprovalFlow:是否触发审批流
triggerWorkflow:是否触发工作流
skipFunctionAction:是否跳过前后动作函数,这个参数设置为true,前后动作的函数都会跳过

返回值类型

APIResult

返回值说明

APIResult的data数据类型 :Map

Java举例

ActionAttribute attribute = ActionAttribute.create();
attribute.setTriggerWorkflow(true);
attribute.setTriggerApprovalFlow(true);
attribute.setSkipFunctionAction(true);
attribute.setDuplicateSearch(false);
APIResult result = Fx.object.bulkRemove("object_oMTq9__c", Lists.newArrayList("id1", "id2"), attribute);

Groovy举例

ActionAttribute attribute = ActionAttribute.build{
 triggerApprovalFlow = false
 triggerWorkflow = false
 skipFunctionAction = true
}
def ret = Fx.object.bulkRemove("object_oMTq9__c",["id1", "id2"],attribute)

注意事项

  • 必须是正常状态的数据才可以作废

18. 编辑团队成员

Fx.object.editTeamMember(<String apiName>, <String objectId>, <List teamMembers>, <boolean ignoreSendingRemind>)

参数说明

参数 类型 说明
apiName String 对象的api名称
objectId String 对象实例的ID
teamMembers List 要编辑团队成员的信息的List(key值包括:
userID:用户ID;
role:添加的团队成员的角色:1-负责人,2-联合跟进人,3-售后服务人员,4-普通成员;
permisson:添加的团队成员的权限:1-只读,2-读写
ignoreSendingRemind boolean 可选参数,是否不发送提醒,true为不发送,不填时为发送

返回值类型

APIResult

返回值说明

APIResult的data数据类型 :Map

Java举例

APIResult result = Fx.object.editTeamMember("AccountObj", "36fd270a986842529445bf3d252cca9b",
         Lists.newArrayList(
             Maps.of("userId", "1058", "role", 4, "permission", 1),
             Maps.of("userId", "1057", "role", 3, "permission", 2))
         );

Groovy举例

def (Boolean error,Map data,String errorMessage) = Fx.object.editTeamMember("AccountObj","36fd270a986842529445bf3d252cca9b",[["userId":"1058","role":4,"permission":1],["userId":"1057","role":3,"permission":2]])

19. 全量替换所有外部成员

Fx.object.replaceOutTeamMember(<String apiName>, <String objectId>, <List outTeamMembers>, <boolean ignoreSendingRemind>)

参数说明

参数 类型 说明
apiName String 对象的api名称
objectId String 对象实例的ID
outTeamMembers List 数组参数,参考,参考以下说明
ignoreSendingRemind boolean 可选参数,是否不发送提醒,true为不发送,不填时为发送

返回值类型

APIResult

(1).参考OutTeamMemberAttribute

20. 添加内部团队成员

Fx.object.addTeamMember(<String apiName>, <String objectId>, <TeamMemberAttribute teamMemberAttribute>)

参数说明

参数 类型 说明
apiName String 对象的api名称
objectId String 对象实例的ID
teamMemberAttribute TeamMemberAttribute 参考以下说明

返回值类型

APIResult

返回值说明

APIResult的data数据类型 :Map

Java举例

// 添加人员
TeamMemberAttribute employTeamMember = TeamMemberAttribute.createEmployMember(Lists.newArrayList("1027"),
       TeamMemberEnum.Role.NORMAL_STAFF,
       TeamMemberEnum.Permission.READONLY);

APIResult employTeamResult = Fx.object.addTeamMember("object_qep6N__c", "61848edfd9007e00019ee222", employTeamMember);
log.info(employTeamResult);

//添加用户组
TeamMemberAttribute groupTeamMember = TeamMemberAttribute.createGroupMember(Lists.newArrayList("6152bd0de3e51c0001ec4de3"),
       TeamMemberEnum.Role.NORMAL_STAFF,
       TeamMemberEnum.Permission.READONLY);
APIResult groupTeamResult = Fx.object.addTeamMember("object_qep6N__c", "61848edfd9007e00019ee222", groupTeamMember);
log.info(groupTeamResult);
//添加部门
TeamMemberAttribute deptTeamMember = TeamMemberAttribute.createDepartmentMember(Lists.newArrayList("1008"),
       TeamMemberEnum.Role.NORMAL_STAFF,
       TeamMemberEnum.Permission.READONLY);
APIResult deptTeamResult = Fx.object.addTeamMember("object_qep6N__c", "61848edfd9007e00019ee222", deptTeamMember);
log.info(deptTeamResult);
//添加角色
TeamMemberAttribute roleTeamMember = TeamMemberAttribute.createRoleMember(Lists.newArrayList("00000000000000000000000000000009"),
       TeamMemberEnum.Role.NORMAL_STAFF,
       TeamMemberEnum.Permission.READONLY);
APIResult roleTeamResult = Fx.object.addTeamMember("object_qep6N__c", "61848edfd9007e00019ee222", roleTeamMember);
log.info(roleTeamResult);

Groovy举例

// 添加人员
def employTeamMember = TeamMemberAttribute.createEmployMember(["1027"], TeamMemberEnum.Role.NORMAL_STAFF, TeamMemberEnum.Permission.READONLY)
def employTeamResult = Fx.object.addTeamMember("object_qep6N__c","61848edfd9007e00019ee222", employTeamMember)
log.info(employTeamResult)
// 添加用户组
def groupTeamMember = TeamMemberAttribute.createGroupMember(["6152bd0de3e51c0001ec4de3"],
                                    TeamMemberEnum.Role.NORMAL_STAFF,
                                    TeamMemberEnum.Permission.READONLY)
def groupTeamResult = Fx.object.addTeamMember("object_qep6N__c","61848edfd9007e00019ee222", groupTeamMember)
log.info(groupTeamResult)
// 添加部门
def deptTeamMember = TeamMemberAttribute.createDepartmentMember(["1008"],
                                        TeamMemberEnum.Role.NORMAL_STAFF,
                                        TeamMemberEnum.Permission.READONLY)
def deptTeamResult = Fx.object.addTeamMember("object_qep6N__c","61848edfd9007e00019ee222", deptTeamMember)
log.info(deptTeamResult)
// 添加角色
def roleTeamMember = TeamMemberAttribute.createRoleMember(["00000000000000000000000000000009"],
                                        TeamMemberEnum.Role.NORMAL_STAFF,
                                        TeamMemberEnum.Permission.READONLY)
def roleTeamResult = Fx.object.addTeamMember("object_qep6N__c","61848edfd9007e00019ee222", roleTeamMember)
log.info(roleTeamResult)

def (Boolean error,Map data,String errorMessage) = Fx.object.addTeamMember("AccountObj","83cf73d957924284a96e9c44ebb333ec", roleTeamMember)
(1).参考TeamMemberAttribute

注意事项

  • 不能添加负责人;如果添加的成员包括负责人,则不会修改负责人数据;如果添加的成员在原系统中有重复的则更新该成员

21. 添加内部团队成员

Fx.object.addTeamMember(<String apiName>, <String objectId>, <List teamMembers>, <int role>, <int permission>, <int teamMemberType>, <boolean ignoreSendingRemind>)

参数说明

参数 类型 说明
apiName String 对象的api名称
objectId String 对象实例的ID
teamMembers List 需要添加的团队成员id集合,默认是人员id list集合,若TeamMemberType参数设置0以外的值时,则为对应类型的id list集合。
role int 添加的团队成员的角色:1-负责人,2-联合跟进人,3-售后服务人员,4-普通成员
permission int 添加的团队成员的权限:1-只读,2-读写
teamMemberType int 可选参数,非必填(如果不填,默认是0) 相关团队类型:0 人员 1 用户组 2 部门 4 角色
ignoreSendingRemind boolean 可选参数,是否不发送提醒,true为不发送,不填时为发送

返回值类型

APIResult

返回值说明

APIResult的data数据类型 :Map

Java举例

APIResult result = Fx.object.addTeamMember("AccountObj", "83cf73d957924284a96e9c44ebb333ec", Lists.newArrayList("1001"), 4, 1, 0);
if (result.isError()) {
   log.info(result.message());
} else {
   log.info(result.getData());
}

Groovy举例

def (Boolean error,Map data,String errorMessage) = Fx.object.addTeamMember("AccountObj","83cf73d957924284a96e9c44ebb333ec",["1001"],4,1,0)
if (error) {
    log.info(errorMessage)
} else {
    log.info('success')
}

注意事项

  • 不能添加负责人;如果添加的成员包括负责人,则不会修改负责人数据;如果添加的成员在原系统中有重复的则更新该成员

22. 添加外部团队成员

Fx.object.addOutTeamMember(<String apiName>, <String objectId>, <int permission>, <List outTeamMemberEmployee>, <boolean ignoreSendingRemind>)

参数说明

参数 类型 说明
apiName String 对象的apiname
objectId String 对象实例的ID
permission int 外部团队成员权限 1:只读 2:读写
outTeamMemberEmployee List 员工信息,其中Map包括【 userId:员工Id ; outTenantId:外部企业id】
ignoreSendingRemind boolean 可选参数,是否不发送提醒,true为不发送,不填时为发送

返回值类型

APIResult

返回值说明

APIResult的data数据类型 :String

Java举例

APIResult result = Fx.object.addOutTeamMember(
       "AccountObj",
       "id",
       1,
       Lists.newArrayList(Maps.of("userId","1001", "outTenantId","590057")),
true);

Groovy举例

def (Boolean error,String data,String errorMessage) = Fx.object.addOutTeamMember('AccountObj',id,1,[['userId':'1001','outTenantId':'590057']], true)

23. 添加外部团队成员

Fx.object.addOutTeamMember(<String apiName>, <String objectId>, <OutTeamMemberAttribute outTeamMemberAttribute>)

参数说明

参数 类型 说明
apiName String 对象的apiname
objectId String 对象实例的ID
outTeamMemberAttribute OutTeamMemberAttribute 参考以下说明

返回值类型

APIResult

返回值说明

APIResult的data数据类型 :String

Java举例

// 添加外部人员
TeamMemberEmployee teamMemberEmployee = TeamMemberEmployee.builder()
       .userId("309175511")
       .outTenantId("301185430")
       .build();
OutTeamMemberAttribute outEmployTeamMember = OutTeamMemberAttribute.createEmployMember(Lists.newArrayList(teamMemberEmployee),
       TeamMemberEnum.Permission.READANDWRITE);
APIResult outEmployTeamResult = Fx.object.addOutTeamMember("object_qep6N__c", "61848edfd9007e00019ee222", outEmployTeamMember);
log.info(outEmployTeamResult);

//添加下游企业
TeamMemberEmployee outTenant = TeamMemberEmployee.builder()
                .userId("300012805")
                .outTenantId("300012805")
                .build();

OutTeamMemberAttribute outTenantTeamMember = OutTeamMemberAttribute.createOutTenantMember(Lists.newArrayList(outTenant),
     TeamMemberEnum.Permission.READANDWRITE);


APIResult outTenantTeamResult = Fx.object.addOutTeamMember("object_qep6N__c", "61848edfd9007e00019ee222", outTenantTeamMember);
log.info(outTenantTeamResult);

//添加外部角色

OutTeamMemberAttribute outRoleTeamMember = OutTeamMemberAttribute.createRoleMember(Lists.newArrayList("5d1f28eee4b0896efc933508"),
     TeamMemberEnum.Permission.READANDWRITE);

APIResult outRoleTeamResult = Fx.object.addOutTeamMember("object_qep6N__c", "61848edfd9007e00019ee222", outRoleTeamMember);
log.info(outRoleTeamResult);

//添加下游企业组

OutTeamMemberAttribute outTenantGroupTeamMember = OutTeamMemberAttribute.createOutTenantGroupMember(Lists.newArrayList("613880213ed24b000150a713"),
     TeamMemberEnum.Permission.READANDWRITE);

APIResult outTenantGroupResult = Fx.object.addOutTeamMember("object_qep6N__c", "61848edfd9007e00019ee222", outTenantGroupTeamMember);
log.info(outTenantGroupResult);

Groovy举例

// 添加外部人员
def teamMemberEmployee = TeamMemberEmployee.builder()
     .userId("309175511")
     .outTenantId("301185430")
     .build()
OutTeamMemberAttribute outEmployTeamMember = OutTeamMemberAttribute.createEmployMember([teamMemberEmployee], TeamMemberEnum.Permission.READANDWRITE)
def outEmployTeamResult = Fx.object.addOutTeamMember("object_qep6N__c","61848edfd9007e00019ee222", outEmployTeamMember)
log.info(outEmployTeamResult)

// 添加下游企业
def outTenant = TeamMemberEmployee.builder()
     .userId("300012805")
     .outTenantId("300012805")
     .build()
OutTeamMemberAttribute outTenantTeamMember = OutTeamMemberAttribute.createOutTenantMember([outTenant], TeamMemberEnum.Permission.READANDWRITE)
def outTenantTeamResult = Fx.object.addOutTeamMember("object_qep6N__c","61848edfd9007e00019ee222", outTenantTeamMember)
log.info(outTenantTeamResult)
// 添加外部角色
OutTeamMemberAttribute outRoleTeamMember = OutTeamMemberAttribute.createRoleMember(["5d1f28eee4b0896efc933508"], TeamMemberEnum.Permission.READANDWRITE)
def outRoleTeamResult = Fx.object.addOutTeamMember("object_qep6N__c","61848edfd9007e00019ee222", outRoleTeamMember)
log.info(outRoleTeamResult)
// 添加下游企业组
OutTeamMemberAttribute outTenantGroupTeamMember = OutTeamMemberAttribute.createOutTenantGroupMember(["613880213ed24b000150a713"], TeamMemberEnum.Permission.READANDWRITE)
def outTenantGroupResult = Fx.object.addOutTeamMember("object_qep6N__c","61848edfd9007e00019ee222", outTenantGroupTeamMember)
log.info(outTenantGroupResult)

def (Boolean error,String data,String errorMessage) = Fx.object.addOutTeamMember('AccountObj',id, outTenantGroupTeamMember)

24. 删除相关团队

Fx.object.deleteTeamMember(<String apiName>, <List objectIds>, <List teamMembers>, <List outTeamMemberEmployee>, <boolean ignoreSendingRemind>)

参数说明

参数 类型 说明
apiName String 对象的api名称
objectIds List 对象实例的IDs
teamMembers List 需要删除的团队成员id集合,默认是人员id list集合,若TeamMemberType参数设置0以外的值时,则为对应类型的id list集合。
outTeamMemberEmployee List 外部成员列表
ignoreSendingRemind boolean 可选参数,是否不发送提醒,true为不发送,不填时为发送

返回值类型

APIResult

返回值说明

APIResult的data数据类型 :Map

Java举例

APIResult result = Fx.object.deleteTeamMember("object_qep6N__c",
                Lists.newArrayList("61848edfd9007e00019ee222"),Lists.newArrayList(),
                Lists.newArrayList(Maps.of("userId","300012805","outTenantId","")) //外部联系人必须这么给
                );
log.info(result)

Groovy举例

def ret = Fx.object.deleteTeamMember("object_qep6N__c",["61848edfd9007e00019ee222"],[],[["userId":"300012805","outTenantId":""]])
log.info(ret)

25. 获取团队成员

Fx.object.getTeamMember(<String apiName>, <String objectId>)

参数说明

参数 类型 说明
apiName String 对象的api名称
objectId String 对象实例的ID

返回值类型

APIResult

返回值说明

APIResult的data数据类型 :List

Java举例

APIResult result = Fx.object.getTeamMember("AccountObj", "83cf73d957924284a96e9c44ebb333ec");

Groovy举例

def (Boolean error,List data,String errorMessage) = Fx.object.getTeamMember("AccountObj","83cf73d957924284a96e9c44ebb333ec")

26. 更换负责人

Fx.object.changeOwner(<String apiName>, <String objectId>, <String ownerId>, <ActionAttribute attribute>)

参数说明

参数 类型 说明
apiName String 对象的api名称
objectId String 对象实例的ID
ownerId String 要变更的负责人的用户ID
attribute ActionAttribute triggerApprovalFlow:是否触发审批流,默认为true
triggerWorkflow:是否触发工作流,默认为true
skipFunctionAction:是否跳过前后动作函数,默认为true

返回值类型

APIResult

返回值说明

Java举例

APIResult result = Fx.object.changeOwner("AccountObj", "ed47841898054749a2ec9be9e6e5d728", "1001");

Groovy举例

def (Boolean error,Map data,String errorMessage) = Fx.object.changeOwner("AccountObj","ed47841898054749a2ec9be9e6e5d728","1001")

27. 批量更换负责人

Fx.object.batchChangeOwner(<String apiName>, <List changeData>, <ActionAttribute attribute>)

参数说明

参数 类型 说明
apiName String 对象的api名称
changeData List 要变更的负责人的数据ID和用户ID
attribute ActionAttribute triggerApprovalFlow:是否触发审批流,默认为true
triggerWorkflow:是否触发工作流,默认为true
skipFunctionAction:是否跳过前后动作函数,默认为true

返回值类型

APIResult

返回值说明

Java举例

Map changeData1 = Maps.newHashMap();
changeData1.put("objectId", "5f86b47b1bdac00001f2c300");
changeData1.put("ownerId", Lists.newArrayList("-10000"));

Map changeData2 = Maps.newHashMap();
changeData2.put("objectId", "5f86b4a71bdac00001f2d232");
changeData2.put("ownerId", Lists.newArrayList("-10000"));

List arg = Lists.newArrayList(changeData1, changeData2);

ActionAttribute attribute = ActionAttribute.create();
attribute.setTriggerWorkflow(true);
attribute.setTriggerApprovalFlow(true);
attribute.setSkipFunctionAction(true);
attribute.setDuplicateSearch(false);

APIResult ret = Fx.object.batchChangeOwner("object_i66LR__c", arg, attribute);
log.info(ret);

Groovy举例

Map changeData1 = [
  "objectId":"5f86b47b1bdac00001f2c300",
  "ownerId":["-10000"]
]
Map changeData2 = [
  "objectId":"5f86b4a71bdac00001f2d232",
  "ownerId":["-10000"]
]
List arg = [changeData1,changeData2]

ActionAttribute attribute = ActionAttribute.build{
      triggerApprovalFlow = false
      triggerWorkflow = false
      skipFunctionAction = true
}
def ret = Fx.object.batchChangeOwner("object_i66LR__c", arg, attribute)
log.info(ret)

28. 获取单选/多选业务名称/选项名称

Fx.object.getOptionName(<String objectAPIName>, <String filedAPIName>, <String value>)

参数说明

参数 类型 说明
objectAPIName String 对象的api名称
filedAPIName String 字段的api名称
value String 单选/多选的值

返回值类型

APIResult

返回值说明

APIResult的data数据类型 :Map

Groovy举例

def (Boolean error,String data,String errorMessage) = Fx.object.getOptionName("AccountObj","lock_status","0")

29. 根据映射规则创建数据

Fx.object.copyByRule(<String sourceApiName>, <String sourceId>, <String ruleApiName>, <Map plus>, <Map detailPlus>)

参数说明

参数 类型 说明
sourceApiName String 被映射的对象Api Name
sourceId String 被映射的对象实例的ID
ruleApiName String 映射规则API Name
plus Map 可选参数,主对象数据参数
detailPlus Map 可选参数,从对象数据参数

返回值类型

APIResult

返回值说明

APIResult的data数据类型 :Map

Java举例

Map plus = Maps.of("field_ZszsOc", "18800154471");
Map detailValues1 = Maps.of("field_z5AI0c", "data1填充内容");
Map detailValues2 = Maps.of("field_z5AI0c", "data2填充内容");
List detailFillValueList = Lists.newArrayList();
detailFillValueList.add(detailValues1);
detailFillValueList.add(detailValues2);
Map detailPlus = Maps.of("object_6hN1ic", detailFillValueList);

APIResult result = Fx.object.copyByRule("object_ob2G0__c", "5cedf0137cfed9b33b75ddaa", "map_797K4__c", plus, detailPlus);

Groovy举例

Map plus = ["field_ZszsOc": "18800154471"]
Map detailValues1 = ["field_z5AI0c": "data1填充内容"]
Map detailValues2 = ["field_z5AI0c": "data2填充内容"]
List detailFillValueList= []
detailFillValueList.add( detailValues1)
detailFillValueList.add( detailValues2)
Map detailPlus = ["object_6hN1ic": detailFillValueList]
def (Boolean error,Map data,String errorMessage) = Fx.object.copyByRule('object_ob2G0__c','5cedf0137cfed9b33b75ddaa','map_797K4__c',plus,detailPlus)

注意事项

  • 使用本方法创建的数据,可以触发审批流以及工作流

30. 数据锁定

Fx.object.lock(<String apiName>, <String objectId>, <boolean cascadeDetail>)

参数说明

参数 类型 说明
apiName String 对象的apiname
objectId String 对象实例id
cascadeDetail boolean 是否锁定从对象

返回值类型

APIResult

返回值说明

Java举例

APIResult result = Fx.object.lock("AccountObj", "e6a338ae8a944cdfb2bae737db1aa12f", true);

Groovy举例

def (Boolean error,data,String errorMessage) = Fx.object.lock('AccountObj','e6a338ae8a944cdfb2bae737db1aa12f' , true)

31. 解锁数据

Fx.object.unlock(<String apiName>, <String objectId>, <boolean cascadeDetail>)

参数说明

参数 类型 说明
apiName String 对象的apiname
objectId String 对象实例id
cascadeDetail boolean 是否解锁从对象

返回值类型

APIResult

返回值说明

Java举例

APIResult result = Fx.object.unlock("AccountObj", "e6a338ae8a944cdfb2bae737db1aa12f", true);

Groovy举例

def (Boolean error,data,String errorMessage) = Fx.object.unlock('AccountObj' , 'e6a338ae8a944cdfb2bae737db1aa12f' , true)

32. 批量锁定

Fx.object.batchLock(<String apiName>, <List objectIds>, <boolean cascadeDetail>)

参数说明

参数 类型 说明
apiName String 对象的apiname
objectIds List 数据id
cascadeDetail boolean 是否锁定从对象

返回值类型

APIResult

Java举例

APIResult result = Fx.object.batchLock("AccountObj" , Lists.newArrayList("e6a338ae8a944cdfb2bae737db1aa12f") , true);

Groovy举例

def (Boolean error,data,String errorMessage) = Fx.object.batchLock('AccountObj' , ["e6a338ae8a944cdfb2bae737db1aa12f"] , true)

33. 批量解锁

Fx.object.batchUnlock(<String apiName>, <List objectIds>, <boolean cascadeDetail>)

参数说明

参数 类型 说明
apiName String 对象的apiname
objectIds List 数据id
cascadeDetail boolean 是否解锁从对象

返回值类型

APIResult

Java举例

APIResult result = Fx.object.batchUnlock("AccountObj" , Lists.newArrayList("e6a338ae8a944cdfb2bae737db1aa12f") , true);

Groovy举例

def (Boolean error,data,String errorMessage) = Fx.object.batchUnlock('AccountObj' , ["e6a338ae8a944cdfb2bae737db1aa12f"] , true)

34. 对象合并(只支持客户和线索对象)

Fx.object.merge(<String apiName>, <String targetDataId>, <List sourceDataIds>, <Map objectData>, <String source>, <boolean needMergeRelationObjects>)

参数说明

参数 类型 说明
apiName String 对象apiName
targetDataId String 保留数据id
sourceDataIds List 并后被删除的数据
objectData Map 合并后更新的字段值
source String 可选参数,来源的页面类型,默认为list(如需要指定,需要与以下参数一并填写)
needMergeRelationObjects boolean 可选参数,是否合并相关对象,默认为true

返回值类型

APIResult

Java举例

String apiName = "LeadsObj";
String targetDataId = "61b9aed9a3c69e0001351a87";
List sourceDataIds = Lists.newArrayList("61b9af07a3c69e000135213f");
Map objectData = Maps.newHashMap();
objectData.put("name", "测试合并10");
objectData.put("mobile", "18840934501");
objectData.put("tel", "18840934501");
objectData.put("url", "www.ceshi44.com");
objectData.put("remark", "测试销售线索1");
objectData.put("source", "2");
objectData.put("marketing_event_id", "618a2e8b869433000198ef41");
objectData.put("leads_pool_id", "2876c6af7815475893bea6092bbffd02");
objectData.put("record_type", "default__c");
objectData.put("close_reason", "");
objectData.put("back_reason", "");
objectData.put("data_own_department", Lists.newArrayList("1001");
objectData.put("mc_exchange_rate", "1.000000");
objectData.put("is_duplicated", false);
objectData.put("data_own_organization", Lists.newArrayList("999999"));
objectData.put("leads_stage_changed_time", 1636873294913L);
APIResult result = Fx.object.merge(apiName, targetDataId, sourceDataIds, objectData);
if (result.isError()) {
   log.info(result.message());
} else {
   log.info(result.getData());
}

Groovy举例

String apiName = "LeadsObj"
String targetDataId = "61b9aed9a3c69e0001351a87"
List sourceDataIds = ["61b9af07a3c69e000135213f"]
Map objectData = [
             "name": "测试合并10",
             "mobile": "18840934501",
             "tel": "18840934501",
             "url": "www.ceshi44.com",
             "remark": "测试销售线索1",
             "source": "2",
             "marketing_event_id": "618a2e8b869433000198ef41",
             "leads_pool_id": "2876c6af7815475893bea6092bbffd02",
             "record_type": "default__c",
             "close_reason": "",
             "back_reason": "",
             "data_own_department": [
             "1001"
         ],
         "mc_exchange_rate": "1.000000",
         "is_duplicated": false,
         "data_own_organization": [
             "999999"
         ],
         "leads_stage_changed_time": 1636873294913,
         ]
def(Boolean error,Map data,String errorMessage) = Fx.object.merge(apiName, targetDataId, sourceDataIds, objectData)
if (error) {
 log.info(errorMessage)
} else{
 log.info(data)
}

35. 对某一字段进行聚合

Fx.object.aggregate(<String apiName>, <Aggregate type>, <List criteria>, <String groupByField>, <FindAttribute attribute>)

参数说明

参数 类型 说明
apiName String 对象的apiname
type Aggregate 计算类型; Aggregate.SUM(String fieldApiName) 求和 Aggregate.COUNT() 计算数量 Aggregate.MAX(String
fieldApiName) 最大值 Aggregate.MIN(String fieldApiName) 最小值 Aggregate.AVG(String fieldApiName)
平均值
criteria List 查询条件(和find查询条件使用一样)
groupByField String 聚合条件
attribute FindAttribute 可选参数
useCurrentIdentity 是否使用当前用户身份查询数据(默认false)(之前是find的独立参数,整合到FindAttribute里,之前的写法兼容)
returnRelatedValue 是否返回相关数据id对应的value值(默认false)
forceQueryFromDB 是否从DB查询数据(默认false)
extendFieldApiNames 需要补充__r的字段apiName

返回值类型

APIResult

返回值说明

data数据类型 String

Java举例

APIResult result = Fx.object.aggregate("object_227xW__c", Aggregate.MAX("field_rzv5M__c"),
       Lists.newArrayList("field_rzv5M__c", QueryOperator.GT(10)),
       "field_qC2yp__c"); //最大值
if (result.isError()) {
 log.info(result.message());
} else {
 log.info(result.getData());
}

Groovy举例

def (Boolean error, List data,String errorMessage) = Fx.object.aggregate("object_227xW__c", Aggregate.MAX("field_rzv5M__c"), [["field_rzv5M__c":Operator.GT(10)]], 'field_qC2yp__c') //最大值
if(error) {
 log.info(errorMessage)
} else {
 log.info(data)
}

36. 普通聚合函数

Fx.object.aggregate(<String apiName>, <Aggregate type>, <int decimalScale>, <List criteria>, <FindAttribute attribute>)

参数说明

参数 类型 说明
apiName String 对象的apiname
type Aggregate 计算类型; Aggregate.SUM(String fieldApiName) 求和 Aggregate.COUNT() 计算数量 Aggregate.MAX(String
fieldApiName) 最大值 Aggregate.MIN(String fieldApiName) 最小值
decimalScale int 2
criteria List 查询条件(和find查询条件使用一样)
attribute FindAttribute 可选参数
useCurrentIdentity 是否使用当前用户身份查询数据(默认false)(之前是find的独立参数,整合到FindAttribute里,之前的写法兼容)
returnRelatedValue 是否返回相关数据id对应的value值(默认false)
forceQueryFromDB 是否从DB查询数据(默认false)
extendFieldApiNames 需要补充__r的字段apiName

返回值类型

APIResult

返回值说明

data数据类型 String

Java举例

APIResult result = Fx.object.aggregate("object_rqa45__c", Aggregate.AVG("field_VE1by__c"), 2,
       Lists.newArrayList(Maps.of("name", QueryOperator.LIKE("name")))
);

Groovy举例

def (Boolean error,String data,String errorMessage) = Fx.object.aggregate("object_rqa45__c", Aggregate.AVG("field_VE1by__c"), 2, [["name":Operator.LIKE("name")])

37. 查询对象描述

Fx.object.findDescribe(<String apiName>)

参数说明

参数 类型 说明
apiName String 对象的api名称

返回值类型

APIResult

返回值说明

data数据类型 Map

Java举例

APIResult result = Fx.object.findDescribe("object_qep6N__c");
log.info(result.getData());

Groovy举例

def (Boolean error,Map data,String errorMessage) = Fx.object.findDescribe('object_qep6N__c')
log.info(data)

38. 单多选/业务类型查询

Fx.object.getOptionInfo(<String apiName>, <String fieldAPIName>)

参数说明

参数 类型 说明
apiName String 对象的apiname
fieldAPIName String 单多选/业务类型的API名称

返回值类型

APIResult

返回值说明

APIResult的data数据类型 :map(label - > value , value - > label 的双向映射)

Java举例

APIResult result = Fx.object.getOptionInfo("object_i66LR__c","record_type");

Groovy举例

def(boolean error, Map result, String errorMessage) = Fx.object.getOptionInfo("object_i66LR__c","record_type")

39. 批量物理删除数据

Fx.object.bulkDelete(<String apiName>, <List objectIds>)

参数说明

参数 类型 说明
apiName String 对象的apiname
objectIds List 数据IDList

返回值类型

APIResult

Java举例

String objectAPIName = "AccountObj";
List objectIds = Lists.newArrayList("60057c76a383690001243bb4","60057c76a383690001243bb5");
APIResult ret = Fx.object.bulkDelete(objectAPIName, objectIds);
if (ret.isError()) {
 log.info("删除数据出错  : " + ret.getData());
}

Groovy举例

def objectAPIName = "AccountObj"
def objectIds = ["60057c76a383690001243bb4", "60057c76a383690001243bb5"]

def ret = Fx.object.bulkDelete(objectAPIName, objectIds)
if( ret[0] ){
 log.info("删除数据出错  : " + ret[2])
}

注意事项

  • 直接删除对象数据,并且不可恢复
  • 必须是已作废的数据,才可以使用本接口进行删除
  • 批量操作建议一次不要超过20条

40. 物理删除数据

Fx.object.delete(<String apiName>, <String objectId>)

参数说明

参数 类型 说明
apiName String 对象的apiname
objectId String 数据ID

返回值类型

APIResult

Java举例

String objectAPIName = "AccountObj";
String objectId = "60057c76a383690001243bb4";
APIResult ret = Fx.object.delete(objectAPIName, objectId);
if (ret.isError()) {
 log.info("删除数据出错  : " + ret.getData());
}

Groovy举例

String objectAPIName = "AccountObj"
def objectId = "60057c76a383690001243bb4"

def ret = Fx.object.delete(objectAPIName,objectIds)
if( ret[0] ){
 Fx.log.info("删除数据出错  : " + ret[2])
}

注意事项

  • 直接删除对象数据,并且不可恢复
  • 必须是已作废的数据,才可以使用本接口进行删除

41. 查询映射信息描述

Fx.object.getMappingRule(<String mappingRuleApiName>)

参数说明

参数 类型 说明
mappingRuleApiName String 映射规则API名称

返回值类型

APIResult

返回值说明

data数据类型 Map

Java举例

APIResult result = Fx.object.getMappingRule("map_ri5oc__c");
log.info(result.getData());

Groovy举例

def (Boolean err,Map data ,String message) = Fx.object.getMappingRule("map_ri5oc__c");
log.info(data)
//{ruleList=[{sourceApiName=AccountObj, targetApiName=MarketingEventObj, ruleName=777, fieldMapping=[{sourceFieldApiName=field_S1Umm__c, targetFieldApiName=field_IZ2nj__c}]}]}

42. 获取单选级联关系配置

Fx.object.getCascadeOption(<OptionAttribute optionAttribute>)

参数说明

参数 类型 说明
optionAttribute OptionAttribute apiName 对象apiName
fieldApiName 父单选字段apiName
optionValue 可选参数,父单选选项值

返回值类型

APIResult

返回值说明

APIResult的data数据类型 :Map

Groovy举例

def optionAttribute = OptionAttribute.builder()
     .apiName("object_qep6N__c")
     .fieldApiName("field_16Yl4__c")
     .optionValue("C3mG8ou09")
.build()

def (Boolean error,Map data,String errorMessage) = Fx.object.getCascadeOption(optionAttribute)
if( !error ){
  log.info("级联关系配置  : " + data)
}OptionAttribute optionAttribute = OptionAttribute.builder()
     .apiName("object_qep6N__c")
     .fieldApiName("field_16Yl4__c")
     .optionValue("C3mG8ou09")
.build();

APIResult result = Fx.object.getCascadeOption(optionAttribute);
log.info(result.getData());

参考类 com.fxiaoke.functions.model.FQLAttribute

字段说明

参数 类型 说明
columns List SELECT [字段]
queryTemplate QueryTemplate WHERE [查询条件],详见QueryTemplate说明
orderBy Map ORDER BY [排序字段] 例如 ["create_time":1]
limit Integer LIMIT [查询数量] 默认10,上限100
skip Integer SKIP [翻页条目]

参考类 com.fxiaoke.functions.model.SelectAttribute

字段说明

参数 类型 说明
dbSource Boolean 是否直接查询DB,默认否
currentIdentity Boolean 是否以当前用户身份进行查询,默认否
needRelevantTeam Boolean 是否需要相关团队,默认否
fillExtendInfo Boolean 是否需要自动填充__r字段,例如人员信息,默认不填充
needCount Boolean 是否返回匹配条件的数量总数,默认否
needCalculate Boolean 查询时是否执行计算字段,默认是
needInvalid Boolean 是否返回已作废的数据,默认否
needQuote Boolean 是否实时计算引用字段,默认是
calculateCount Boolean 是否实时计算统计字段,默认否

参考类 com.fxiaoke.functions.tools.QueryOperator

1. 查询与条件相等的数据

QueryOperator.EQ(<java.lang.Object values>)

参数说明

参数 类型 说明
values Object 内容

返回值类型

com.fxiaoke.functions.tools.QueryOperator

Java举例

List criteria = Lists.newArrayList(Maps.of("name", QueryOperator.EQ("测试")));

Groovy举例:

List criteria = [["name": Operator.EQ("测试")]]

2. 查询与条件不相等的数据

QueryOperator.NE(<java.lang.Object values>)

参数说明

参数 类型 说明
values Object 内容

返回值类型

com.fxiaoke.functions.tools.QueryOperator

Java举例

List criteria = Lists.newArrayList(Maps.of("name", QueryOperator.NE("测试")));

Groovy举例:

List criteria = [["name": Operator.NE("测试")]]

3. 查询比条件大的数据

QueryOperator.GT(<java.lang.Object values>)

参数说明

参数 类型 说明
values Object 内容

返回值类型

com.fxiaoke.functions.tools.QueryOperator

Java举例

List criteria = Lists.newArrayList(Maps.of("create_time", QueryOperator.GT(1645427372658)));

Groovy举例:

List criteria = [["create_time": Operator.GT(1645427372658)]]

4. 查询比条件小的数据

QueryOperator.LT(<java.lang.Object values>)

参数说明

参数 类型 说明
values Object 内容

返回值类型

com.fxiaoke.functions.tools.QueryOperator

Java举例

List criteria = Lists.newArrayList(Maps.of("create_time", QueryOperator.LT(1645427372658)));

Groovy举例:

List criteria = [["create_time": Operator.LT(1645427372658)]]

5. 查询大于等于条件的数据

QueryOperator.GTE(<java.lang.Object values>)

参数说明

参数 类型 说明
values Object 内容

返回值类型

com.fxiaoke.functions.tools.QueryOperator

Java举例

List criteria = Lists.newArrayList(Maps.of("create_time", QueryOperator.GTE(1645427372658)));

Groovy举例:

List criteria = [["create_time": Operator.GTE(1645427372658)]]

6. 查询小于等于条件的数据

QueryOperator.LTE(<java.lang.Object values>)

参数说明

参数 类型 说明
values Object 内容

返回值类型

com.fxiaoke.functions.tools.QueryOperator

Java举例

List criteria = Lists.newArrayList(Maps.of("create_time", QueryOperator.LTE(1645427372658)));

Groovy举例:

List criteria = [["create_time": Operator.LTE(1645427372658)]]

7. 模糊匹配字符串内容

QueryOperator.LIKE(<java.lang.Object values>)

参数说明

参数 类型 说明
values Object 内容

返回值类型

com.fxiaoke.functions.tools.QueryOperator

Java举例

List criteria = Lists.newArrayList(Maps.of("name", Operator.LIKE("易动纷享")));

Groovy举例:

List criteria = [["name": Operator.LIKE("易动纷享")]]

8. 除模糊匹配字符串内容

QueryOperator.NLIKE(<java.lang.Object values>)

参数说明

参数 类型 说明
values Object 内容

返回值类型

com.fxiaoke.functions.tools.QueryOperator

Java举例

List criteria = Lists.newArrayList(Maps.of("name", Operator.LIKE("易动纷享")));

Groovy举例:

List criteria = [["name": Operator.LIKE("易动纷享")]]

9. 查询有交集的数据

如数据是[1,2,3],查询条件是[1,4] 则返回(因为有1) 如数据是[1,2,3],查询条件是[4,5] 则不返回

QueryOperator.IN(<java.util.List list>)

参数说明

参数 类型 说明
list List 内容

返回值类型

com.fxiaoke.functions.tools.QueryOperator

Java举例

List criteria = Lists.newArrayList(Maps.of("name", Operator.IN(Lists.newArrayList("易动", "纷享"))));

Groovy举例:

List criteria = [["name": Operator.IN(["易动", "纷享"])]]

10. 查询无交集的数据

QueryOperator.NIN(<java.util.List list>)

参数说明

参数 类型 说明
list List 内容

返回值类型

com.fxiaoke.functions.tools.QueryOperator

Java举例

List criteria = Lists.newArrayList(Maps.of("name", Operator.NIN(Lists.newArrayList("易动", "纷享"))));

Groovy举例:

List criteria = [["name": Operator.NIN(["易动", "纷享"])]]

11. 查询数据的数组字段匹配输入条件的子集

如数据是[1,2,3],查询条件是[1,2] 则返回 如数据是[1,2,3],查询条件是[3,4] 则不返回

QueryOperator.CONTAINS(<java.util.List list>)

参数说明

参数 类型 说明
list List 内容

返回值类型

com.fxiaoke.functions.tools.QueryOperator

Java举例

List criteria = Lists.newArrayList(Maps.of("name", Operator.CONTAINS(Lists.newArrayList("易动", "纷享"))));

Groovy举例:

List criteria = [["name": Operator.CONTAINS(["易动", "纷享"])]]

12. 查询数据的数组字段匹配输入条件的子集之外的数据

如数据是[1,2,3],查询条件是[1,2] 则不返回 如数据是[1,2,3],查询条件是[3,4] 则返回

QueryOperator.NCONTAINS(<java.util.List list>)

参数说明

参数 类型 说明
list List 内容

返回值类型

com.fxiaoke.functions.tools.QueryOperator

Java举例

List criteria = Lists.newArrayList(Maps.of("name", Operator.NCONTAINS(Lists.newArrayList("易动", "纷享"))));

Groovy举例:

List criteria = [["name": Operator.NCONTAINS(["易动", "纷享"])]]

13. 查询任何匹配数组任一内容的数据

QueryOperator.HASANYOF(<java.util.List list>)

参数说明

参数 类型 说明
list List 数组

返回值类型

com.fxiaoke.functions.tools.QueryOperator

Java举例

List criteria = Lists.newArrayList(Maps.of("name", Operator.HASANYOF(Lists.newArrayList("易动", "纷享"))));

Groovy举例:

List criteria = [["name": Operator.HASANYOF(["易动", "纷享"])]]

14. 查询都不在数组内的数据

QueryOperator.NHASANYOF(<java.util.List list>)

参数说明

参数 类型 说明
list List 数组

返回值类型

com.fxiaoke.functions.tools.QueryOperator

Java举例

List criteria = Lists.newArrayList(Maps.of("name", Operator.NHASANYOF(Lists.newArrayList("易动", "纷享"))));

Groovy举例:

List criteria = [["name": Operator.NHASANYOF(["易动", "纷享"])]]

15. 查询数据字段(是/否)存在内容的数据

QueryOperator.EXISTS(<boolean exists>)

参数说明

参数 类型 说明
exists boolean 是/否

返回值类型

com.fxiaoke.functions.tools.QueryOperator

Java举例

List criteria = Lists.newArrayList(Maps.of("name", Operator.EXISTS(true)));

Groovy举例:

List criteria = [["name": Operator.EXISTS(true]]

16. 查询以...为开始的数据

QueryOperator.STARTWITH(<java.lang.Object values>)

参数说明

参数 类型 说明
values Object 内容

返回值类型

com.fxiaoke.functions.tools.QueryOperator

Java举例

List criteria = Lists.newArrayList(Maps.of("name", Operator.STARTWITH("易动")));

Groovy举例:

List criteria = [["name": Operator.STARTWITH("易动")]]

17. 查询以...为结束的数据

QueryOperator.ENDWITH(<java.lang.Object values>)

参数说明

参数 类型 说明
values Object 内容

返回值类型

com.fxiaoke.functions.tools.QueryOperator

Java举例

List criteria = Lists.newArrayList(Maps.of("name", Operator.ENDWITH("易动")));

Groovy举例:

List criteria = [["name": Operator.ENDWITH("易动")]]

18. 查询在...范围内的数据

QueryOperator.BETWEEN(<java.util.List list>)

参数说明

参数 类型 说明
list List 范围数据

返回值类型

com.fxiaoke.functions.tools.QueryOperator

Java举例

List criteria = Lists.newArrayList(Maps.of("name", Operator.BETWEEN(Lists.newArrayList(154542372658, 1645427372658))));

Groovy举例:

List criteria = [["name": Operator.BETWEEN([154542372658, 1645427372658])]]

参考类 com.fxiaoke.functions.tools.OutTeamMemberAttribute

1. 添加外部成员

OutTeamMemberAttribute.createEmployMember(<List teamMemberList>, <Permission permission>)

参数说明

参数 类型 说明
teamMemberList List 添加外部人员列表
permission Permission TeamMemberEnum.Permission.READONLY //只读
TeamMemberEnum.Permission.READANDWRITE //读写
TeamMemberEnum.Permission.NO_PERMISSION //无权限

返回值类型

OutTeamMemberAttribute

Java举例

TeamMemberEmployee teamMemberEmployee = TeamMemberEmployee.builder()
     .userId("309175511")
     .outTenantId("301185430")
     .build();
OutTeamMemberAttribute outEmployTeamMember = OutTeamMemberAttribute.createEmployMember(
                Lists.newArrayList(teamMemberEmployee), TeamMemberEnum.Permission.READANDWRITE);
APIResult outEmployTeamResult = Fx.object.addOutTeamMember("object_qep6N__c", "61848edfd9007e00019ee222", outEmployTeamMember);
log.info(outEmployTeamResult);

Groovy举例:

def teamMemberEmployee = TeamMemberEmployee.builder()
         .userId("309175511")
         .outTenantId("301185430")
         .build()
OutTeamMemberAttribute outEmployTeamMember = OutTeamMemberAttribute.createEmployMember([teamMemberEmployee], TeamMemberEnum.Permission.READANDWRITE)
def outEmployTeamResult = Fx.object.addOutTeamMember("object_qep6N__c","61848edfd9007e00019ee222", outEmployTeamMember)
log.info(outEmployTeamResult)

2. 添加下游企业

OutTeamMemberAttribute.createOutTenantMember(<List teamMemberList>, <Permission permission>)

参数说明

参数 类型 说明
teamMemberList List 下游企业列表
permission Permission TeamMemberEnum.Permission.READONLY //只读
TeamMemberEnum.Permission.READANDWRITE //读写
TeamMemberEnum.Permission.NO_PERMISSION //无权限

返回值类型

OutTeamMemberAttribute

Java举例

TeamMemberEmployee teamMemberEmployee = TeamMemberEmployee.builder()
     .userId("309175511")
     .outTenantId("301185430")
     .build();
OutTeamMemberAttribute outEmployTeamMember = OutTeamMemberAttribute.createOutTenantMember(
                Lists.newArrayList(teamMemberEmployee), TeamMemberEnum.Permission.READANDWRITE);
APIResult outEmployTeamResult = Fx.object.addOutTeamMember("object_qep6N__c", "61848edfd9007e00019ee222", outEmployTeamMember);
log.info(outEmployTeamResult);

Groovy举例:

def outTenant = TeamMemberEmployee.builder()
.userId("300012805")
.outTenantId("300012805")
.build()
OutTeamMemberAttribute outTenantTeamMember = OutTeamMemberAttribute.createOutTenantMember([outTenant], TeamMemberEnum.Permission.READANDWRITE)
def outTenantTeamResult = Fx.object.addOutTeamMember("object_qep6N__c","61848edfd9007e00019ee222", outTenantTeamMember)
log.info(outTenantTeamResult)

3. 添加外部角色

OutTeamMemberAttribute.createRoleMember(<List userIds>, <Permission permission>)

参数说明

参数 类型 说明
userIds List 角色Id列表
permission Permission TeamMemberEnum.Permission.READONLY //只读
TeamMemberEnum.Permission.READANDWRITE //读写
TeamMemberEnum.Permission.NO_PERMISSION //无权限

返回值类型

OutTeamMemberAttribute

Java举例

OutTeamMemberAttribute outRoleTeamMember = OutTeamMemberAttribute.createRoleMember(
         Lists.newArrayList("5d1f28eee4b0896efc933508"),
         TeamMemberEnum.Permission.READANDWRITE);
APIResult outRoleTeamResult = Fx.object.addOutTeamMember("object_qep6N__c", "61848edfd9007e00019ee222", outRoleTeamMember);
log.info(outRoleTeamResult);

Groovy举例:

OutTeamMemberAttribute outRoleTeamMember = OutTeamMemberAttribute.createRoleMember(["5d1f28eee4b0896efc933508"], TeamMemberEnum.Permission.READANDWRITE)
def outRoleTeamResult = Fx.object.addOutTeamMember("object_qep6N__c","61848edfd9007e00019ee222", outRoleTeamMember)
log.info(outRoleTeamResult)

4. 添加下游企业组

OutTeamMemberAttribute.createOutTenantGroupMember(<List userIds>, <Permission permission>)

参数说明

参数 类型 说明
userIds List 企业组
permission Permission TeamMemberEnum.Permission.READONLY //只读
TeamMemberEnum.Permission.READANDWRITE //读写
TeamMemberEnum.Permission.NO_PERMISSION //无权限

返回值类型

OutTeamMemberAttribute

Java举例

OutTeamMemberAttribute outTenantGroupTeamMember = OutTeamMemberAttribute.createOutTenantGroupMember(
     Lists.newArrayList("613880213ed24b000150a713"),
     TeamMemberEnum.Permission.READANDWRITE);
APIResult outTenantGroupResult = Fx.object.addOutTeamMember("object_qep6N__c", "61848edfd9007e00019ee222", outTenantGroupTeamMember);
log.info(outTenantGroupResult);

Groovy举例:



OutTeamMemberAttribute outTenantGroupTeamMember = OutTeamMemberAttribute.createOutTenantGroupMember(["613880213ed24b000150a713"], TeamMemberEnum.Permission.READANDWRITE)
def outTenantGroupResult = Fx.object.addOutTeamMember("object_qep6N__c","61848edfd9007e00019ee222", outTenantGroupTeamMember)
log.info(outTenantGroupResult)

参考类 com.fxiaoke.functions.tools.TeamMemberAttribute

1. 添加内部成员

TeamMemberAttribute.createEmployMember(<java.util.List<java.lang.String> teamMembers>, <com.fxiaoke.functions.enums.TeamMemberEnum.Role role>, <com.fxiaoke.functions.enums.TeamMemberEnum.Permission permission>)

参数说明

参数 类型 说明
teamMembers List 员工IDList
role Role TeamMemberEnum.Role.OWNER //负责人
TeamMemberEnum.Role.FOLLOWER //联合跟进人
TeamMemberEnum.Role.SERVICE_STAFF //售后服务人员
TeamMemberEnum.Role.NORMAL_STAFF //普通成员
TeamMemberEnum.Role.NOT_EXIST //不在其中
permission Permission TeamMemberEnum.Permission.READONLY //只读
TeamMemberEnum.Permission.READANDWRITE //读写
TeamMemberEnum.Permission.NO_PERMISSION //无权限

返回值类型

com.fxiaoke.functions.tools.TeamMemberAttribute

Java举例

TeamMemberAttribute employTeamMember = TeamMemberAttribute.createEmployMember(
     Lists.newArrayList("1027"),
     TeamMemberEnum.Role.NORMAL_STAFF,
     TeamMemberEnum.Permission.READONLY);
employTeamMember.setIgnoreSendingRemind(true) // 可选参数,是否忽略发送CRM提醒。默认false
employTeamMember.setRealtime(true) // 可选参数,是否实时生效。默认false
APIResult employTeamResult = Fx.object.addTeamMember("object_qep6N__c", "61848edfd9007e00019ee222", employTeamMember);
log.info(employTeamResult);

Groovy举例:

def employTeamMember = TeamMemberAttribute.createEmployMember(["1027"], TeamMemberEnum.Role.NORMAL_STAFF, TeamMemberEnum.Permission.READONLY)
employTeamMember.setIgnoreSendingRemind(true) // 可选参数,是否忽略发送CRM提醒。默认false
employTeamMember.setRealtime(true) // 可选参数,是否实时生效。默认false
def employTeamResult = Fx.object.addTeamMember("object_qep6N__c","61848edfd9007e00019ee222", employTeamMember)
log.info(employTeamResult)

2. 添加用户组成员

TeamMemberAttribute.createGroupMember(<java.util.List<java.lang.String> teamMembers>, <com.fxiaoke.functions.enums.TeamMemberEnum.Role role>, <com.fxiaoke.functions.enums.TeamMemberEnum.Permission permission>)

参数说明

参数 类型 说明
teamMembers List 用户组IDList
role Role TeamMemberEnum.Role.OWNER //负责人
TeamMemberEnum.Role.FOLLOWER //联合跟进人
TeamMemberEnum.Role.SERVICE_STAFF //售后服务人员
TeamMemberEnum.Role.NORMAL_STAFF //普通成员
TeamMemberEnum.Role.NOT_EXIST //不在其中
permission Permission TeamMemberEnum.Permission.READONLY //只读
TeamMemberEnum.Permission.READANDWRITE //读写
TeamMemberEnum.Permission.NO_PERMISSION //无权限

返回值类型

com.fxiaoke.functions.tools.TeamMemberAttribute

Java举例

TeamMemberAttribute employTeamMember = TeamMemberAttribute.createEmployMember(
                Lists.newArrayList("1027"),
                TeamMemberEnum.Role.NORMAL_STAFF,
                TeamMemberEnum.Permission.READONLY);
employTeamMember.setIgnoreSendingRemind(true) // 可选参数,是否忽略发送CRM提醒。默认false
employTeamMember.setRealtime(true) // 可选参数,是否实时生效。默认false
APIResult employTeamResult = Fx.object.addTeamMember(
                "object_qep6N__c",
                "61848edfd9007e00019ee222",
                employTeamMember);
log.info(employTeamResult);

Groovy举例:

def employTeamMember = TeamMemberAttribute.createEmployMember(["1027"], TeamMemberEnum.Role.NORMAL_STAFF, TeamMemberEnum.Permission.READONLY)
employTeamMember.setIgnoreSendingRemind(true) // 可选参数,是否忽略发送CRM提醒。默认false
employTeamMember.setRealtime(true) // 可选参数,是否实时生效。默认false
def employTeamResult = Fx.object.addTeamMember("object_qep6N__c","61848edfd9007e00019ee222", employTeamMember)
log.info(employTeamResult)

3. 添加部门成员

TeamMemberAttribute.createDepartmentMember(<java.util.List<java.lang.String> teamMembers>, <com.fxiaoke.functions.enums.TeamMemberEnum.Role role>, <com.fxiaoke.functions.enums.TeamMemberEnum.Permission permission>)

参数说明

参数 类型 说明
teamMembers List 部门IDList
role Role TeamMemberEnum.Role.OWNER //负责人
TeamMemberEnum.Role.FOLLOWER //联合跟进人
TeamMemberEnum.Role.SERVICE_STAFF //售后服务人员
TeamMemberEnum.Role.NORMAL_STAFF //普通成员
TeamMemberEnum.Role.NOT_EXIST //不在其中
permission Permission TeamMemberEnum.Permission.READONLY //只读
TeamMemberEnum.Permission.READANDWRITE //读写
TeamMemberEnum.Permission.NO_PERMISSION //无权限

返回值类型

com.fxiaoke.functions.tools.TeamMemberAttribute

Java举例

TeamMemberAttribute deptTeamMember = TeamMemberAttribute.createDepartmentMember(
                Lists.newArrayList("1008"),
                TeamMemberEnum.Role.NORMAL_STAFF,
                TeamMemberEnum.Permission.READONLY);
deptTeamMember.setIgnoreSendingRemind(true) // 可选参数,是否忽略发送CRM提醒。默认false
deptTeamMember.setRealtime(true) // 可选参数,是否实时生效。默认false
APIResult deptTeamResult = Fx.object.addTeamMember("object_qep6N__c", "61848edfd9007e00019ee222", deptTeamMember);
log.info(deptTeamResult);

Groovy举例:

def deptTeamMember = TeamMemberAttribute.createDepartmentMember(["1008"], TeamMemberEnum.Role.NORMAL_STAFF, TeamMemberEnum.Permission.READONLY)
deptTeamMember.setIgnoreSendingRemind(true) // 可选参数,是否忽略发送CRM提醒。默认false
deptTeamMember.setRealtime(true) // 可选参数,是否实时生效。默认false
def deptTeamResult = Fx.object.addTeamMember("object_qep6N__c","61848edfd9007e00019ee222", deptTeamMember)
log.info(deptTeamResult)

4. 添加角色成员

TeamMemberAttribute.createRoleMember(<java.util.List<java.lang.String> teamMembers>, <com.fxiaoke.functions.enums.TeamMemberEnum.Role role>, <com.fxiaoke.functions.enums.TeamMemberEnum.Permission permission>)

参数说明

参数 类型 说明
teamMembers List 员工ID列表
role Role TeamMemberEnum.Role.OWNER //负责人
TeamMemberEnum.Role.FOLLOWER //联合跟进人
TeamMemberEnum.Role.SERVICE_STAFF //售后服务人员
TeamMemberEnum.Role.NORMAL_STAFF //普通成员
TeamMemberEnum.Role.NOT_EXIST //不在其中
permission Permission TeamMemberEnum.Permission.READONLY //只读
TeamMemberEnum.Permission.READANDWRITE //读写
TeamMemberEnum.Permission.NO_PERMISSION //无权限

返回值类型

com.fxiaoke.functions.tools.TeamMemberAttribute

Java举例

TeamMemberAttribute roleTeamMember = TeamMemberAttribute.createRoleMember(
         Lists.newArrayList("00000000000000000000000000000009"),
         TeamMemberEnum.Role.NORMAL_STAFF,
         TeamMemberEnum.Permission.READONLY);
roleTeamMember.setIgnoreSendingRemind(true) // 可选参数,是否忽略发送CRM提醒。默认false
roleTeamMember.setRealtime(true) // 可选参数,是否实时生效。默认false
APIResult roleTeamResult = Fx.object.addTeamMember("object_qep6N__c", "61848edfd9007e00019ee222", roleTeamMember);
log.info(roleTeamResult);

Groovy举例:

def roleTeamMember = TeamMemberAttribute.createRoleMember(["00000000000000000000000000000009"], TeamMemberEnum.Role.NORMAL_STAFF, TeamMemberEnum.Permission.READONLY)
roleTeamMember.setIgnoreSendingRemind(true) // 可选参数,是否忽略发送CRM提醒。默认false
roleTeamMember.setRealtime(true) // 可选参数,是否实时生效。默认false
def roleTeamResult = Fx.object.addTeamMember("object_qep6N__c","61848edfd9007e00019ee222", roleTeamMember)
log.info(roleTeamResult)

results matching ""

    No results matching ""