Fx. object

Fx.object: APIs related to object operations and APIs related to object operations

1. Create a new slave object at the same time as the object is created

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | the api name of the object |
| objectData | Map | The main object data is the field value |
| details | Map | From object data |
| attribute | ActionAttribute | triggerApprovalFlow: Whether to trigger the approval flow
triggerWorkflow: Whether to trigger the workflow
skipFunctionAction: Whether to skip the pre-validation function, the default is false
specifyCreatedBy: The default creator is the system, Set the specified key in objectData by specifying parameters: < created_by:List <String> > Pass in the id of the person to set the creator
specifyTime: specify the creation time, the default creation time is the current time, you can specify the parameter Set the specified key:create_time in objectData, you can set the creation time, the format of the time is millisecond timestamp
duplicateSearch: Whether to check the duplicate search when the object is enabled, the default is true
skipAfterFunction: Whether to skip the post-action function, the default is false |

return type

APIResult

Return value description

data data type Map

Java example

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", "Master and slave create at the same time"), //Master object
 Maps.of(
     "object_detail1__c", Lists.newArrayList( // from object
             Maps.of("name", "Zhang San 1", "customFiled__c", "test1"),
             Maps.of("name", "Lisi 1", "customField__c", "test2")),
     "object_detail2__c", Lists.newArrayList(
             Maps.of("name", "Zhang San 2", "customFiled__c", "test1"),
             Maps.of("name", "Lisi 2", "customField__c", "test2"))
), attribute);

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

Groovy example

ActionAttribute attribute = ActionAttribute. build {
   triggerApprovalFlow = false
   triggerWorkflow = false
   skipFunctionAction = true
   specifyCreatedBy = true
   specifyTime = true
   duplicateSearch = false
}
 //Master and slave create at the same time, one master object, two slave object data
def(Boolean error,Map data,String errorMessage) = Fx.object.create(
      "object_master__c", // apiName
      ["name":"Master and slave create at the same time"], //Master object
      [ // from object
         "object_detail1__c":[["name":"Zhang San 1","customFiled__c":"test1"],["name":"Li Si 1","customField__c":"test2"]],
         "object_detail2__c":[["name":"Zhang San 2","customFiled__c":"test1"],["name":"Li Si 2","customField__c":"test2"]]
      ],
      attribute)

// create only one object
def(Boolean error,Map data,String errorMessage) = Fx.object.create("object_master__c",["name":"only create master"],null,attribute)

Precautions

  • details are not passed or empty neither from the object

2. Create a new slave object at the same time as the object is created

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | the api name of the object |
| objectData | Map | The main object data is the field value |
| details | Map | From object data |
| attribute | CreateAttribute | triggerApprovalFlow: Whether to trigger the approval flow
triggerWorkflow: Whether to trigger the workflow
skipFunctionAction: Whether to skip the previous verification function, the default is false
specifyCreatedBy: The default creator is the system, Set the specified key in objectData by specifying parameters: < created_by:List <String> > Pass in the id of the person to set the creator
specifyTime: specify the creation time, the default creation time is the current time, you can specify the parameter Set the specified key:create_time in objectData, you can set the creation time, the format of the time is millisecond timestamp
duplicateSearch: Whether to check the duplicate search when the object is enabled, the default is true
skipAfterFunction: Whether to skip the post-action function, the default is false
runbusiness: whether to use business logic, otherwise use the metadata interface |

return type

APIResult

returnvalue description

data data type Map

Java example

CreateAttribute attribute = CreateAttribute. builder()
                .triggerApprovalFlow(false)
                .triggerWorkflow(false)
                .skipFunctionAction(true)
                .specifyCreatedBy(true)
                .specifyTime(true)
                .duplicateSearch(false)
                .runBusiness(true).build()
APIResult result = Fx.object.create(
 "object_master__c", // apiName
 Maps.of("name", "Master and slave create at the same time"), //Master object
 Maps.of(
     "object_detail1__c", Lists.newArrayList( // from object
             Maps.of("name", "Zhang San 1", "customFiled__c", "test1"),
             Maps.of("name", "Lisi 1", "customField__c", "test2")),
     "object_detail2__c", Lists.newArrayList(
             Maps.of("name", "Zhang San 2", "customFiled__c", "test1"),
             Maps.of("name", "Lisi 2", "customField__c", "test2"))
), attribute);

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

Groovy example

CreateAttribute attribute = CreateAttribute. builder()
                            .runBusiness(true)
                            .build()
 //Master and slave create at the same time, one master object, two slave object data
def(Boolean error,Map data,String errorMessage) = Fx.object.create(
      "object_master__c", // apiName
      ["name":"Master and slave create at the same time"], //Master object
      [ // from object
         "object_detail1__c":[["name":"Zhang San 1","customFiled__c":"test1"],["name":"Li Si 1","customField__c":"test2"]],
         "object_detail2__c":[["name":"Zhang San 2","customFiled__c":"test1"],["name":"Li Si 2","customField__c":"test2"]]
      ],
      attribute)

// create only one object
def(Boolean error,Map data,String errorMessage) = Fx.object.create("object_master__c",["name":"only create master"],null,attribute)

Precautions

  • details are not passed or empty neither from the object

3. Create data in batches

Fx.object.batchCreate(<String apiName>, <List objects>, <CreateAttribute attribute>)

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ---------------------------------------- |
| apiName | String | the api name of the object |
| objects | List | Object data is the field value |
| attribute | CreateAttribute | triggerApprovalFlow: Whether to trigger the approval flow
triggerWorkflow: Whether to trigger the workflow
skipFunctionAction: Whether to skip the previous verification function, the default is false
specifyCreatedBy: The default creator is the system, Set the specified key in objectData by specifying parameters: < created_by:List <String> > Pass in the id of the person to set the creator
specifyTime: specify the creation time, the default creation time is the current time, you can specify the parameter Set the specified key:create_time in objectData, you can set the creation time, the format of the time is millisecond timestamp
duplicateSearch: Whether to check the duplicate search when the object is enabled, the default is true
skipAfterFunction: Whether to skip the post-action function, the default is false
runbusiness: whether to use business logic, otherwise use the metadata interface |

return type

APIResult

Return value description

data data type List

Java example

CreateAttribute attribute = CreateAttribute. builder()
        .triggerApprovalFlow(false)
        .triggerWorkflow(false)
        .skipFunctionAction(true)
        .specifyCreatedBy(true)
        .specifyTime(true)
        .duplicateSearch(false)
        .runBusiness(true).build();
Fx.object.batchCreate(
     "AccountObj",
     Lists.newArrayList(Maps.of("name", "Customer 1"), Maps.of("name", "Customer 2")),
     attribute);

Groovy example

CreateAttribute attribute = CreateAttribute. builder()
                .triggerApprovalFlow(false)
                .triggerWorkflow(false)
                .skipFunctionAction(true)
                .specifyCreatedBy(true)
                .specifyTime(true)
                .duplicateSearch(false)
                .runBusiness(true).build()
def(Boolean error, List data, String errorMessage) = Fx.object.batchCreate("AccountObj",[["name":"Customer 1"],["name":"Customer 2"]],attribute)

4. Create data in batches

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ------------------------------------- |
| apiName | String | the api name of the object |
| objects | List | Object data is the field value |
| triggerWorkflow | Boolean | optional parameter, whether to trigger the workflow, the default is false |

return type

APIResult

Return value description

data data type List

Java example

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

Groovy example

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

Precautions

  • It is not recommended to use this API to create batches of preset objects.
  • Batch creation will not trigger object business logic (judging permissions, triggering approval flow, etc.), and whether to trigger workflow is controlled by parameters.

5. Update data object

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | the api name of the object |
| objectId | String | Data ID |
| updateFields | Map | Object data is the field value |
| triggerWorkFlow | Boolean | optional parameter, whether to trigger the workflow, the default is true, to trigger the workflow |
| duplicatedSearch | Boolean | optional parameter, whether to perform duplicate search, the default is false, do not perform duplicate search |

return type

APIResult

Return value description

data data type Map

Java example

APIResult result = Fx.object.update("AccountObj", "id123456", Maps.of("name", "Funshare Sales"), false, false);

Groovy example

def (Boolean error,Map data,String errorMessage) = Fx.object.update("AccountObj","id123456",["name":"Fanxiang Sales"],false)

6. Master-slave coverage update

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | the api name of the object |
| objectId | String | Object data is the field value |
| updateFields | Map | Object data is the field value |
| detailData | Map | from object data |
| actionAttribute | ActionAttribute | Optional parameters
triggerApprovalFlow: whether to trigger the approval flow
triggerWorkflow: whether to trigger the workflow
skipFunctionAction: whether to skip the pre-validation function, the default is false
specifyCreatedBy: The default creator is the system, and the specified key is set in the objectData through parameters: < created_by:List <String> > The id of the incoming person can be set as the creator
duplicateSearch: whether to enable duplicate search on the object Perform duplicate check, the default is true
skipAfterFunction: Whether to skip the after action function, the default is false |

return type

APIResult

Return value description

data data type Map

Java example

String objectApiName = "object_qs2nb__c";
String objectId = "607d5e3dd02b9f00016507d8";
Map objectMap = Maps.of("name", "check");
Map detailMap = Maps.of("object_cDxt8__c", Maps.of("name", "I am from the object, I was changed by the function"));

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 example

String objectApiName = "object_qs2nb__c"
String objectId = "607d5e3dd02b9f00016507d8"
Map objectMap = ["name":"check",]
Map detailMap = ["object_cDxt8__c":[["name": "I am from the object, I was changed by the function"]]]
ActionAttribute attribute = ActionAttribute. build {
     triggerApprovalFlow = true
     triggerWorkflow = true
     the 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)
}

Precautions

  • Coverage update, if null or empty is passed, the coverage will be null or empty
  • If you don't want to update the slave object, the detailData will be null, if it is empty, the slave object will be cleared

7. Conditional update

Fx.object.update(<String apiName>, <QueryTemplate template>, <Map updateFields>, <UpdateAttribute attribute>)

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | the api name of the object |
| template | QueryTemplate | Query conditions, see QueryTemplate description for details |
| updateFields | Map | Modify content |
| attribute | UpdateAttribute | optional parameters
triggerWorkflow: whether to trigger the workflow
duplicateSearch: whether to check the duplicateSearch when the object is turned on, the default is true
runBusiness: whether to follow the business logic If not, use the metadata interface, the default is true
isAllUpdate: Whether to update all data, when it is false, only update 1000 pieces of data at most, when it is true, there is no limit on the number, the default is false |

return type

APIResult

Return value description

data data type Map

Java example

String objectApiName = "object_qs2nb__c";
Map updateFields = Maps.of("name", "check");

UpdateAttribute attribute = UpdateAttribute.builder().build();
APIResult result = Fx.object.update(objectApiName, QueryTemplate.AND(Maps.of("name", QueryOperator.EQ("test"))), updateFields, attribute);
if (result. isError()) {
    log.info(result.message());
} else {
    log.info(result.getData());
}

Groovy example

String objectApiName = "object_qs2nb__c"
UpdateAttribute attribute = UpdateAttribute. builder()
     .triggerWorkflow(true)
     .duplicateSearch(false)
     .runBusiness(true).build()
def ret = Fx.object.update(objectApiName, QueryTemplate.AND(["name":QueryOperator.EQ("test")]), ["name":"check"], attribute)
if(ret.isError()){
 log. info(ret. message())
}else{
 log. info(ret. getData())
}

(1). Refer to QueryOperator
Precautions

  • Limit the number of updates to a maximum of 10,000

8. Obtain duplicate check results

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | object apiName |
| type | String | type of duplicate checking, among them, "NEW" when creating and editing, and "TOOL" when using a duplicate checking tool |
| data | Map | update, new data |
| relatedApiName | String | The apiName of the object with search association relationship (Note: do not need to pass when searching this object) |
| pageNumber | Integer | display page number |
| pageSize | Integer | Items per page |

return type

APIResult

Return value description

data data type List

Java example

Map data = Maps. newHashMap();
data.put("object_describe_api_name", "object_227xW__c");
data.put("field_rT3cG__c", "Function test 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 example

Map data = ["object_describe_api_name":"object_227xW__c","field_rT3cG__c":"Function Test 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)
}

9. Batch update data

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

Parameter Description

| parameter | type | description |
| ------------ | ------------| -------------------------------------------------- ----------- |
| apiName | String | the api name of the object |
| objects | Map | Object data is the field value (the key value is the object ID) |

return type

APIResult

Return value description

data data type List

Java example

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

Groovy example

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

Precautions

  • This function will not trigger object business logic (judging permissions, triggering approval flow, etc.).

10. Batch update the content of a field

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | the api name of the object |
| objects | Map | Data information for batch update |
| fields | List | list of fields in batch update |

return type

APIResult

Return value description

data data type List

Java example

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 example

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)
}

Precautions

  • This interface will not trigger object business logic (such as: judging permissions, triggering approval flow, etc.).
  • The field specified in fields must exist in objects, if it does not exist, it means empty.

11. FQL query

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | object ApiName |
| fqlAttribute | FQLAttribute | Query conditions, refer to the FQLAttribute object for details |
| selectAttribute | SelectAttribute | Query attribute, optional, please refer to SelectAttribute for details |

return type

APIResult

Return value description

Data data type of APIResult: List

Groovy example

APIResult ret = Fx.object.find("AccountObj", //Query customer object
             FQLAttribute. builder()
                .columns(["_id", "name"]) //returned data id
                .queryTemplate( QueryTemplate.AND(["_id": QueryOperator.EQ("6177cde7a0cb410001930ad0")] ))
                .build(),
             SelectAttribute. builder()
                .build());
if(ret.isError()){
    log.info(ret.message());
}

log. info(ret. data)

(1). Refer to FQLAttribute
(2). Refer to SelectAttribute
(3). Refer to QueryOperator


12. FQL query single data

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | object ApiName |
| fqlAttribute | FQLAttribute | query condition, detailedDescription reference FQLAttribute object |
| selectAttribute | SelectAttribute | Query attribute, optional, please refer to SelectAttribute for details |

return type

APIResult

Return value description

Data data type of APIResult: Map

Groovy example

APIResult ret = Fx.object.findOne("AccountObj", //Query customer object
             FQLAttribute. builder()
                .columns(["_id", "name"]) //returned data id
                .queryTemplate( QueryTemplate.AND(["_id": QueryOperator.EQ("6177cde7a0cb410001930ad0")] ))
                .build(),
             SelectAttribute. builder()
                .build());
if(ret.isError()){
    log.info(ret.message());
}

log. info(ret. data)

(1). Refer to FQLAttribute
(2). Refer to SelectAttribute
(3). Refer to QueryOperator


13. FQL query single data Id

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | object ApiName |
| id | String | Data Id |
| fqlAttribute | FQLAttribute | Query conditions, refer to FQLAttribute for details |
| selectAttribute | SelectAttribute | Query attribute, optional, please refer to SelectAttribute for details |

return type

APIResult

Return value description

Data data type of APIResult: Map

Groovy example

APIResult ret = Fx.object.findById("AccountObj", //Query customer object
             "6177cde7a0cb410001930ad0",
             FQLAttribute. builder()
                .columns(["_id","name"]) //returned data id
                .build(),
             SelectAttribute. builder()
                .build());
if(ret.isError()){
    log.info(ret.message());
}

log. info(ret. data)

(1). Refer to FQLAttribute
(2). Refer to SelectAttribute


14. FQL query the data set matching the data id

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | object ApiName |
| ids | List | Data Id list |
| fqlAttribute | FQLAttribute | Query conditions, refer to FQLAttribute for details |
| selectAttribute | SelectAttribute | Query attribute, optional, please refer to SelectAttribute for details |

return type

APIResult

Return value description

Data data type of APIResult: List

Groovy example

APIResult ret = Fx.object.findByIds("AccountObj", //Query customer object
             ["6177cde7a0cb410001930ad0"],
             FQLAttribute. builder()
                .columns(["_id","name"]) //returned data id
                .build(),
             SelectAttribute. builder()
                .build());
if(ret.isError()){
    log.info(ret.message());
}

log. info(ret. data)

(1). Refer to FQLAttribute
(2). Refer to SelectAttribute
(3). Refer to QueryOperator


15. Query data through SQL statements, you can set whether to query from db, whether to query the total number, whether to check related teams and other parameters

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| sql | String | sql statement for querying data |
| selectAttribute | SelectAttribute | Special query conditions, optional |

return type

APIResult

Return value description

Data data type of APIResult: QueryResult

Java example

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

//If the query does not contain obsolete data, return the total number of data that meets the conditions
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 example

1. What is FQL
 FQL is a SQL-like query statement that can be used in APL. Developers can use FQL in APL to query business data in enterprises.

2. FQL syntax
 SELECT
    fieldname1 [, fieldname2 ...]
    [FROM object apiName
    [WHERE where_condition]
    [ORDER BY {col_name | expr | position}
      [ASC | DESC], ...]
    [LIMIT {[offset,] row_count | row_count OFFSET offset}]
Notes
- does not support select * to query all fields, only select field1, field2... to find relevant fields on demand
-limit defaults to 10, the maximum value is 100, offset defaults to 0
- The use of the OR condition needs to be activated separately, please contact the sales staff to place an order to activate the product: [object list filtering support or]

3. Operators supported by Where condition
- AND query: AND
 select name from object_227xW__c where (field_rzv5M__c is null and field_rzv5M__c<= 100) order by last_modified_time desc limit 10 offset 0;

-Or query: OR (the AND operator in SQL has a higher priority than the OR operator, and you need to use parentheses when you want to execute the OR operator first)
 select name from object_227xW__c where (field_rzv5M__c is null or field_rzv5M__c<= 100) order by last_modified_time desc limit 10 offset 0;

- Judge equality and inequality: =, !=
 select _id, field_rzv5M__c, name from object_227xW__c where field_oc43W__c = '13988523405' limit 10 offset 0;
 select _id, field_rzv5M__c, name from object_227xW__c where field_oc43W__c != '13988523405' limit 10 offset 0;
 select _id, field_rzv5M__c, name from object_227xW__c where field_rzv5M__c = 100 limit 10 offset 0;
 select _id, field_rzv5M__c, name from object_227xW__c where field_rzv5M__c != 100 limit 10 offset 0;

- greater than: >, less than: <select _id, field_rzv5M__c, name from object_227xW__c where field_rzv5M__c>100 limit 10 offset 0;
 select _id, field_rzv5M__c, name from object_227xW__c where field_rzv5M__c<100 limit 10 offset 0;

- greater than or equal to: >=, less than or equal to: =<select _id, field_rzv5M__c, name from object_227xW__c where field_rzv5M__c>= 100 limit 10 offset 0;
 select _id, field_rzv5M__c, name from object_227xW__c where field_rzv5M__c<= 100 limit 10 offset 0;

- Fuzzy query: like, not like, when like 'xx' does not put %, it is equivalent to =
 select _id, field_rzv5M__c, name from object_227xW__c where field_oc43W__c like '%88523%';
 select _id, field_rzv5M__c, name from object_227xW__c where field_oc43W__c like '%88523';
 select _id, field_rzv5M__c, name from object_227xW__c where field_oc43W__c like '88523%';
 select _id, field_rzv5M__c, name from object_227xW__c where field_oc43W__c not like '%88523%';

- Null value judgment: is null, is not null
 select _id, field_rzv5M__c, name from object_227xW__c where field_rzv5M__c is null;
 select _id, field_rzv5M__c, name from object_227xW__c where field_rzv5M__c is not null;

-The array contains: @>, suitable for fields with data type List such as unit, multi-choice, person, department, etc.
 select _id, field_D8JyW__c, name from object_227xW__c where field_D8JyW__c @>ARRAY['option1', 'option2'];

-in statement: IN, NOT IN
 select _id, field_rzv5M__c, name from object_227xW__c where field_rzv5M__c IN (21, 100);
 select _id, field_rzv5M__c, name from object_227xW__c where field_rzv5M__c not IN (21, 100);

-between statement: BETWEEN AND, NOT BETWEEN AND
 select _id, field_rzv5M__c, name from object_227xW__c where field_rzv5M__c BETWEEN 21 and 100;
 select _id, field_rzv5M__c, name from object_227xW__c where field_rzv5M__c not BETWEEN 21 and 100;

4. Advanced usage
-Supports comparison between fields, does not support in, between, @> and other operators
 select name from AccountObj where last_modified_time>create_time;
 select name from AccountObj where name != firstName;
 select name from AccountObj where name = firstName;
 select name from AccountObj where name<= firstName;

- Aggregation query supports aggregation functions count/sum/min/max/avg and grouping aggregation grooup by (having is not supported),
 select count(1) from object_227xW__c where field_qC2yp__c is not null
 select sum(field_rzv5M__c) from object_227xW__c where field_qC2yp__c is not null group by field_qC2yp__c
 select max(field_rzv5M__c) from object_227xW__c where field_qC2yp__c is not null group by field_qC2yp__c
 select min(field_rzv5M__c) from object_227xW__c where field_qC2yp__c is not null group by field_qC2yp__c
 select avg(field_rzv5M__c) from object_227xW__c where field_qC2yp__c is not null group by field_qC2yp__c
 // Multiple aggregate functions and multiple group by fields
 select avg(field_rzv5M__c), sum(field_rzv5M__c) from object_227xW__c where field_qC2yp__c is not null group by field_qC2yp__c, record_type

- Subquery, currently only supports: field in/not in (subquery)
 select _id, name from object_qe3x1__c where field_4rSu9__c in (select id from object_227xW__c where name = '2021---07--2207')
 // nested subqueries
 select _id, name from object_qe3x1__c where field_4rSu9__c in (select id from object_227xW__c where field_09jTD__c in (select id from object_qe3x1__c where name = 'zaishisyice'))

5. Code example
Note: When Fx.object.select is used to query data normally, the data type in the return value is QueryResult, and the type of data in aggregate query is List
//Common usage
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)

//If the query does not contain obsolete data, return the total number of data that meets the conditions
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). Refer to SelectAttribute


16. Use queryTemplate to implement or condition data filtering

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | the api name of the object |
| queryTemplate | QueryTemplate | query condition queryTemplate |
| orderBy | Map | Sorting rules key: which field to sort by, field name; value: 1 - ascending order, -1 - descending order |
| limit | Integer | Limit the number of queries, the maximum is 100, if more than 100 are returned, use the skip parameter to query in batches |
|ip | Integer | How many data to skip |
| attribute | FindAttribute | Optional parameter
useCurrentIdentity Whether to use the current user identity to query data (default false) (previously it was an independent parameter of find, integrated into FindAttribute, the previous writing is compatible)
returnRelatedValue Whether to return related The value corresponding to the data id (default false)
forceQueryFromDB whether to query data from DB (default false)
extendFieldApiNames needs to add the field apiName of __r |

return type

APIResult

Return value description

The data data type of APIResult QueryResult

Java example

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

        //sort by 1 - ascending, -1 - descending
        Map order = Maps.of("name", 1);

//QueryTemplate needs to be opened separately when using the OR condition, please contact the sales staff to place an order to activate the product: [object list filtering support 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 example

QueryTemplate template1 = QueryTemplate.AND(["name": Operator.LIKE("test")])
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 needs to be opened separately when using the OR condition, please contact the sales staff to place an order to activate the product: [object list filtering support 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)
}

Precautions

  • There will be a delay in querying data. If you have high real-time requirements, please specify to query from the database (use with caution in non-real-time scenarios, low performance)

###17. Use when querying a large amount of data and need to turn pages

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | APIName of the object |
| searchCondition | List | query conditions |
| closure | Closure | Closure, refer to the following instructions |
| lastId | String | optional parameter, last data id |
| attribute | FindAttribute | Optional parameter
useCurrentIdentity Whether to use the current user identity to query data (default false) (previously it was an independent parameter of find, integrated into FindAttribute, the previous writing is compatible)
returnRelatedValue Whether to return related The value corresponding to the data id (default false)
forceQueryFromDB whether to query data from DB (default false)
extendFieldApiNames needs to add the field apiName of __r |

return type

APIResult

Java example

//java does not currently support closure writing

Groovy example

//The maximum number of data in the closure returned at one time is 2W. If it is more than 2W, it is necessary to use the lastId of the return value to execute the find function in a loop
def closure = {
     List list ->//Cycle aggregate all data, 100 pieces are a batch
     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)
}

Precautions

  • The date format in the condition uses a millisecond timestamp
  • When forceQueryFromDB is true, the query efficiency is low, and it is recommended to use it in scenarios with high real-time data requirements, such as calling the find function query immediately after creating or updating data
  • There will be a delay in querying data. If you have high real-time requirements, please specify to query from the database (use with caution in non-real-time scenarios, low performance)

18. This function can query related data by looking for association or master-slave relationship, and return together

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

Parameter Description

| parameter | type | description |
| ------------ | ------------| -------------------------------------------------- ----------- |
| apiName | String | api name of master object / api name of slave object |
| relatedField | String | The related field of the master object / The master object field of the slave object |
| criteria | List | search criteria |
| orderBy | Map | Sorting rules key: which field to sort by, field name; value: 1 - ascending order, -1 - descending order |
| limit | Integer | Limit the number of queries, the maximum is 100, if more than 100 are returned, use the skip parameter to query in batches |
| skip | Integer | How many data to skip |
| attribute | ActionAttribute | Optional parameter
triggerApprovalFlow: whether to trigger the approval flow
triggerWorkflow: whether to trigger the workflow
skipFunctionAction: whether to skip the front and back action functions, this parameter is set to true, the front and back actions The function will skip
specifyTime: specify the creation time, the default creation time is the current time, you can set the specified key in objectData by specifying parameters: create_time, you can set the creation time, the format of the time is millisecond timestamp
duplicateSearch: Whether to perform duplicate search when the object is enabled for duplicate search, the default is true |

return type

APIResult

Return value description

The data data type of APIResult: QueryResult

Java example

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"));//sub-object
   log.info(data.get("AccountObj"));//main object
});

Groovy example

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'])
}
```Precautions 
- When using this function to search for associations, the ApiName given is the ApiName of the main object, and relatedField is the associated field for search
- When using this function as a master-slave query, the ApiName given is the ApiName of the slave object, and the relatedField is the field of the master object

----------
### 19. To query data through searchQuery, you can set whether to use data permissions through parameters (the total number will not be returned)
> **Fx.object.findBySearchQuery(&lt;String apiName>, &lt;String userId>, &lt;Map searchQuery>)**

 Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | object apiName |
| userId | String | User id, whose identity is used to query data |
| searchQuery | Map | searchQuery |

return type
> APIResult

Return value description
> The data data type of APIResult is List

Java example
```java
String objectApiName = "SalesOrderObj";
String userId = "1017";
Map<String, Object>searchQueryInfo = Maps.newLinkedHashMap();
searchQueryInfo. put("limit", 10);
searchQueryInfo. put("offset", 0);
searchQueryInfo. put("filters", Lists. newArrayList());
searchQueryInfo.put("orders", Lists.newArrayList(Maps.of("fieldName", "last_modified_time", "isAsc", false)));
searchQueryInfo. put("permissionType", 1);
searchQueryInfo.put("dataRightsParameter", Maps.of("sceneType", "user", "roleType", 1, "isDetailObject", false));

Map<String, Object>searchQuery = Maps. newLinkedHashMap();
searchQuery.put("search_query_info", searchQueryInfo);
searchQuery. put("search_template_id", null);
searchQuery. put("search_template_type", "default");
searchQuery.put("ignore_scene_filter", true);
searchQuery.put("ignore_scene_record_type", true);

APIResult result = Fx.object.findBySearchQuery(objectApiName, userId, searchQuery);
if (result. isError()) {
  log.info("error:" + result.message());
} else {
  log.info(result.getData());
}

Groovy example

String objectApiName = "SalesOrderObj"
String userId = "1017"


Map searchQueryInfo = [
  "limit": 10,
  "offset": 0,
  "filters": [],
  "orders": [
    [
      "fieldName": "last_modified_time",
      "isAsc": false
    ]
  ],
  "permissionType": 1,
  "dataRightsParameter": [
    "sceneType": "user",
    "roleType": 1,
    "isDetailObject": false
  ]
]

Map searchQuery = [
  "search_query_info": searchQueryInfo,
  "search_template_id": null,
  "search_template_type": "default",
  "ignore_scene_filter": true,
  "ignore_scene_record_type": true
]

def(Boolean error, List dataList, String message) = Fx. object. findBySearchQuery(objectApiName, userId, searchQuery)
if (error) {
  log. info("error:" + message)
} else {
  log. info(dataList)
}

20. Query the total number through searchQuery (no data will be returned)

Fx.object.findTotalBySearchQuery(<String apiName>, <String userId>, <Map searchQuery>)

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | object apiName |
| userId | String | User id, whose identity is used to query data |
| searchQuery | Map | searchQuery |

return type

APIResult

Return value description

The data data type of APIResult is List

Java example

String objectApiName = "SalesOrderObj";
String userId = "1017";
Map<String, Object>searchQueryInfo = Maps.newLinkedHashMap();
searchQueryInfo. put("limit", 10);
searchQueryInfo. put("offset", 0);
searchQueryInfo. put("filters", Lists. newArrayList());
searchQueryInfo.put("orders", Lists.newArrayList(Maps.of("fieldName", "last_modified_time", "isAsc", false)));
searchQueryInfo. put("permissionType", 1);
searchQueryInfo.put("dataRightsParameter", Maps.of("sceneType", "user", "roleType", 1, "isDetailObject", false));

Map<String, Object>searchQuery = Maps. newLinkedHashMap();
searchQuery.put("search_query_info", searchQueryInfo);
searchQuery. put("search_template_id", null);
searchQuery.put("search_template_type", "default");
searchQuery.put("ignore_scene_filter", true);
searchQuery.put("ignore_scene_record_type", true);

APIResult result = Fx.object.findTotalBySearchQuery(objectApiName, userId, searchQuery);
if (result. isError()) {
  log.info("error:" + result.message());
} else {
  log.info(result.getData());
}

Groovy example

String objectApiName = "SalesOrderObj"
String userId = "1017"
Map searchQueryInfo = [
  "limit": 10,
  "offset": 0,
  "filters": [ ],
  "orders": [
    [
      "fieldName": "last_modified_time",
      "isAsc": false
    ]
  ],
  "permissionType": 1,
  "dataRightsParameter": [
    "sceneType": "user",
    "roleType": 1,
    "isDetailObject": false
  ]
]

Map searchQuery = [
  "search_query_info": searchQueryInfo,
  "search_template_id": null,
  "search_template_type": "default",
  "ignore_scene_filter": true,
  "ignore_scene_record_type": true
]
def(Boolean error, Long total, String message) = Fx. object. findTotalBySearchQuery(objectApiName, userId, searchQuery)
if (error) {
  log. info("error:" + message)
} else {
  log. info(total)
}

21. Void business object

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | the api name of the object |
| objectId | String | ID of the object instance |

return type

APIResult

Return value description

The data data type of APIResult Map

Java example

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

Groovy example

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

22. Batch invalidation

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

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | object APIName |
| objectIds | List | data id |
| attribute | ActionAttribute | Optional parameter
triggerApprovalFlow: whether to trigger the approval flow
triggerWorkflow: whether to trigger the workflow
skipFunctionAction: whether to skip the front and back action functions, this parameter is set to true, the front and back actions function will be skipped |

return type

APIResult

Return value description

Data data type of APIResult: Map

Java example

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 example

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

Precautions

  • The data must be in a normal state before it can be invalidated

23. Editorial Team Members

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | the api name of the object |
| objectId | String | ID of the object instance |
| teamMembers | List | List of team member information to be edited (key values ​​include:
userID: user ID;
role: role of the added team member: 1-responsible, 2-joint follow-up Person, 3-after-sales service personnel, 4-ordinary members;
permission: Permissions of added team members: 1-read-only, 2-read-write |
| ignoreSendingRemind | Boolean| Optional parameter, whether not to send reminders, true means not to send, if not filled, it is sent |

return type

APIResult

Return value description

Data data type of APIResult: Map

Java example

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 example

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

24. Replace all external members in full

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | the api name of the object |
| objectId | String | ID of the object instance |
| outTeamMembers | List | Array parameters, reference, refer to the following instructions |
| ignoreSendingRemind | Boolean | Optional parameter, whether to send reminders, true means not to send, leave it blank to send |

return type

APIResult

(1). Refer to OutTeamMemberAttribute


25. Add internal team members

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | the api name of the object |
| objectId | String | ID of the object instance|
| teamMemberAttribute | TeamMemberAttribute | Refer to the following instructions |

return type

APIResult

Return value description

Data data type of APIResult: Map

Java example

// add people
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);

//add user group
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);
//add department
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);
//add role
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 example

// add people
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)
// add user group
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)
// add department
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)
// add role
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). Refer to TeamMemberAttribute
Precautions

  • The person in charge cannot be added; if the added member includes the person in charge, the data of the person in charge will not be modified; if the added member is duplicated in the original system, the member will be updated

26. Add internal team members

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | the api name of the object |
| objectId | String | ID of the object instance |
| teamMembers | List | The id collection of team members to be added, the default is the personnel id list collection, if the TeamMemberType parameter is set to a value other than 0, it will be the corresponding type of id list collection. |
| role | Integer | Roles of added team members: 1-responsible person, 2-joint follow-up person, 3-after-sales service personnel, 4-ordinary member |
| permission | Integer | The permission of the added team member: 1-read-only, 2-read-write |
| teamMemberType | Integer | Optional parameter, optional (if not filled, the default is 0) Related team type: 0 person 1 user group 2 department 4 role |
| ignoreSendingRemind | Boolean | Optional parameter, whether to send reminders, true means not to send, leave it blank to send |

return type

APIResult

Return value description

Data data type of APIResult: Map

Java example

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 example

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')
}

Precautions

  • The person in charge cannot be added; if the added member includes the person in charge, the data of the person in charge will not be modified; if the added member is duplicated in the original system, the member will be updated

27. Add external team members

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | apiname of the object |
| objectId | String | ID of the object instance |
| permission | Integer | External team member permission 1: read-only 2: read-write |
| outTeamMemberEmployee | List | Employee information, where Map includes [ userId: employee Id; outTenantId: external enterprise id] |
| ignoreSendingRemind | Boolean| Optional parameter, whether not to send reminders, true means not to send, if not filled, it is sent |

return type

APIResult

Return value description

Data data type of APIResult: String

Java example

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

Groovy example

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

28. Add external team members

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | apiname of the object |
| objectId | String | ID of the object instance |
| outTeamMemberAttribute | OutTeamMemberAttribute | Refer to the following instructions |

return type

APIResult

Return value description

Data data type of APIResult: String

Java example

// add outsiders
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);

//Add downstream enterprises
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);

// add external roles

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

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

//Add downstream enterprise group

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

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

Groovy example

// add outsiders
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)

// add downstream companies
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)
// add external roles
OutTeamMemberAttribute outRoleTeamMember = OutTeamMemberAttribute.createRoleMember(["5d1f28eee4b0896efc933508"], TeamMemberEnum.Permission.READANDWRITE)
def outRoleTeamResult= Fx.object.addOutTeamMember("object_qep6N__c","61848edfd9007e00019ee222", outRoleTeamMember)
log.info(outRoleTeamResult)
// add downstream business group
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)

29. Delete related teams

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | the api name of the object |
| objectIds | List | IDs of object instances |
| teamMembers | List | The id collection of team members to be deleted, the default is the personnel id list collection, if the TeamMemberType parameter is set to a value other than 0, it will be the corresponding type of id list collection. |
| outTeamMemberEmployee | List | external member list |
| ignoreSendingRemind | Boolean | Optional parameter, whether to send reminders, true means not to send, leave it blank to send |

return type

APIResult

Return value description

Data data type of APIResult: Map

Java example

APIResult result = Fx.object.deleteTeamMember("object_qep6N__c",
                Lists.newArrayList("61848edfd9007e00019ee222"),Lists.newArrayList(),
                Lists.newArrayList(Maps.of("userId","300012805","outTenantId","")) //External contacts must give this
                );
log. info(result)

Groovy example

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

30. Get team members

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | the api name of the object |
| objectId | String | ID of the object instance |

return type

APIResult

Return value description

Data data type of APIResult: List <Map>

Java example

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

Groovy example

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

31. Change of person in charge

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | the api name of the object |
| objectId | String | ID of the object instance |
| ownerId | String | User ID of the owner to be changed |
| attribute | ActionAttribute | triggerApprovalFlow: Whether to trigger the approval flow, the default is true
triggerWorkflow: Whether to trigger the workflow, the default is true
skipFunctionAction: Whether to skip the front and rear action functions, the default is true |

return type

APIResult

Return value description

none

Java example

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

Groovy example

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

----------### 32. Batch replacement of the person in charge

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | the api name of the object |
| changeData | List | Data ID and user ID of the person in charge to be changed |
| attribute | ActionAttribute | triggerApprovalFlow: Whether to trigger the approval flow, the default is true
triggerWorkflow: Whether to trigger the workflow, the default is true
skipFunctionAction: Whether to skip the front and rear action functions, the default is true |

return type

APIResult

Return value description

none

Java example

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 example

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)

33. Get single/multi-choice business name/option name

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| objectAPIName | String | API name of the object |
| filedAPIName | String | API name of the field |
| value | String | single/multiple selection value |

return type

APIResult

Return value description

Data data type of APIResult: Map

Groovy example

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

34. Create data according to mapping rules

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| sourceApiName | String | Api Name of the mapped object |
| sourceId | String | ID of the mapped object instance |
| ruleApiName | String | Mapping rule API Name |
| plus | Map | optional parameter, main object data parameter |
| detailPlus | Map | optional parameter, data parameter from object |

return type

APIResult

Return value description

Data data type of APIResult: Map

Java example

Map plus = Maps.of("field_ZszsOc", "18800154471");
Map detailValues1 = Maps.of("field_z5AI0c", "data1 filling content");
Map detailValues2 = Maps.of("field_z5AI0c", "data2 filling content");
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 example

Map plus = ["field_ZszsOc": "18800154471"]
Map detailValues1 = ["field_z5AI0c": "data1 filling content"]
Map detailValues2 = ["field_z5AI0c": "data2 filling content"]
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)

Precautions

  • The data created by this method can trigger the approval flow and workflow

35. Data Locking

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | apiname of the object |
| objectId | String | object instance id |
| cascadeDetail | Boolean | Whether to lock slave objects |

return type

APIResult

Return value description

none

Java example

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

Groovy example

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

36. Unlock data

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | apiname of the object |
| objectId | String | object instance id |
|cascadeDetail| Boolean | Whether to unlock the slave object |

return type

APIResult

Return value description

none

Java example

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

Groovy example

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

37. Batch locking

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | apiname of the object |
| objectIds | List | data id |
| cascadeDetail | Boolean | Whether to lock slave objects |

return type

APIResult

Java example

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

Groovy example

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

38. Batch unlock

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | apiname of the object |
| objectIds | List | data id |
| cascadeDetail | Boolean | Whether to unlock slave objects |

return type

APIResult

Java example

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

Groovy example

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

39. Object merge (only support customer and lead objects)

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | object apiName |
| targetDataId | String | reserved data id |
| sourceDataIds | List | and deleted data |
| objectData | Map | updated field value after merging |
| source | String | optional parameter, the page type of the source, the default is list (if it needs to be specified, it needs to be filled in together with the following parameters) |
| needMergeRelationObjects | Boolean | optional parameter, whether to merge related objects, the default is true |

return type

APIResult

Java example

String apiName = "LeadsObj";
String targetDataId = "61b9aed9a3c69e0001351a87";
List sourceDataIds = Lists.newArrayList("61b9af07a3c69e000135213f");
Map objectData = Maps. newHashMap();
objectData.put("name", "Test merge 10");
objectData.put("mobile", "18840934501");
objectData.put("tel", "18840934501");
objectData.put("url", "www.ceshi44.com");
objectData.put("remark", "Test lead 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 example

String apiName = "LeadsObj"
String targetDataId = "61b9aed9a3c69e0001351a87"
List sourceDataIds = ["61b9af07a3c69e000135213f"]
Map objectData = [
             "name": "Test Merge 10",
             "mobile": "18840934501",
             "tel": "18840934501",
             "url": "www.ceshi44.com",
             "remark": "Test Lead 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)
}

40. Aggregate a field

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | apiname of the object |
| type | Aggregate | Computation type; Aggregate.SUM(String fieldApiName) Sum Aggregate.COUNT() Compute quantity Aggregate.MAX(String
fieldApiName) Maximum Aggregate.MIN(String fieldApiName) Minimum Aggregate.AVG(String fieldApiName)
Average |
| criteria | List | Query criteria (same as find query criteria) |
| groupByField | String | aggregation condition |
| attribute | FindAttribute | Optional parameter
useCurrentIdentity Whether to use the current user identity to query data (default false) (previously it was an independent parameter of find, integrated into FindAttribute, the previous writing is compatible)
returnRelatedValue Whether to return related The value corresponding to the data id (default false)
forceQueryFromDB whether to query data from DB (default false)
extendFieldApiNames needs to add the field apiName of __r |

return type

APIResult

Return value description

data data type String

Java example

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

Groovy example

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') //maximum value
if(error) {
 log. info(errorMessage)
} else {
 log. info(data)
}

41. Ordinary aggregate functions

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | apiname of the object |
| type | Aggregate | calculation type; Aggregate.SUM(String fieldApiName) sum Aggregate.COUNT() calculation quantity Aggregate.MAX(String
fieldApiName) maximum value Aggregate.MIN(String fieldApiName) minimum value |
|decimalScale| Integer | 2 |
| criteria | List | Query criteria (same as find query criteria) |
| attribute | FindAttribute | Optional parameter
useCurrentIdentity Whether to use the current user identity to query data (default false) (previously it was an independent parameter of find, integrated into FindAttribute, the previous writing is compatible)
returnRelatedValue Whether to return related The value corresponding to the data id (default false)
forceQueryFromDB whether to query data from DB (default false)
extendFieldApiNames needs to add the field apiName of __r |

return type

APIResult

Return value description

data data type String

Java example

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

Groovy example

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

42. Query object description

Fx.object.findDescribe(<String apiName>)

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | the api name of the object |

return type

APIResult

Return value description

data data type Map

Java example

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

Groovy example

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

43. Single-multiple selection/business type query

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | apiname of the object |
| fieldAPIName | String | API name of single-multiple choice/business type|

return type

APIResult

Return value description

The data data type of APIResult: map (label -> value, value -> label bidirectional mapping)

Java example

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

Groovy example

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

44. Batch physical deletion of data

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | apiname of the object |
| objectIds | List | data IDList |

return type

APIResult

Java example

String objectAPIName = "AccountObj";
List objectIds = Lists.newArrayList("60057c76a383690001243bb4","60057c76a383690001243bb5");
APIResult ret = Fx.object.bulkDelete(objectAPIName, objectIds);
if (ret. isError()) {
 log.info("Error deleting data: " + ret.getData());
}

Groovy example

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

def ret = Fx.object.bulkDelete(objectAPIName, objectIds)
if( ret[0] ){
 log.info("Error deleting data: " + ret[2])
}

Precautions

  • Directly delete the object data, and it is not recoverable
  • Only obsolete data can be deleted using this interface
  • Batch operation is recommended not to exceed 20 at a time

45. Physically delete data

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| apiName | String | apiname of the object |
| objectId | String | Data ID |

return type

APIResult

Java example

String objectAPIName = "AccountObj";
String objectId ="60057c76a383690001243bb4";
APIResult ret = Fx.object.delete(objectAPIName, objectId);
if (ret. isError()) {
 log.info("Error deleting data: " + ret.getData());
}

Groovy example

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

def ret = Fx.object.delete(objectAPIName, objectIds)
if( ret[0] ){
 Fx.log.info("Error deleting data: " + ret[2])
}

Precautions

  • Directly delete the object data, and it is not recoverable
  • Only obsolete data can be deleted using this interface

46. Query mapping information description

Fx.object.getMappingRule(<String mappingRuleApiName>)

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| mappingRuleApiName | String | Mapping rule API name |

return type

APIResult

Return value description

data data type Map

Java example

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

Groovy example

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}]}]}

47. Get the radio cascading relationship configuration

Fx.object.getCascadeOption(<OptionAttribute optionAttribute>)

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| optionAttribute | OptionAttribute | apiName object apiName
fieldApiName parent radio field apiName
optionValue optional parameter, parent radio option value |

return type

APIResult

Return value description

Data data type of APIResult: Map

Groovy example

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("Cascade relationship configuration: " + 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());

Reference class com.fxiaoke.functions.tools.QueryOperator

1. Query data equal to the condition

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| values ​​| Object | content |

return type

com.fxiaoke.functions.tools.QueryOperator

Java example

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

Groovy example:

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

2. Query the data that is not equal to the condition

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| values ​​| Object | content |

return type

com.fxiaoke.functions.tools.QueryOperator

Java example

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

Groovy example:

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

3. Query data larger than the condition

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| values ​​| Object | content |

return type

com.fxiaoke.functions.tools.QueryOperator

Java example

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

Groovy example:

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

4. Query data smaller than the condition

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| values ​​| Object | content |

return type

com.fxiaoke.functions.tools.QueryOperator

Java example

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

Groovy example:

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

5. Query data greater than or equal to the condition

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| values ​​| Object | content |

return type

com.fxiaoke.functions.tools.QueryOperator

Java example

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

Groovy example:

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

6. Query the data less than or equal to the condition

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| values ​​| Object | content |

return type

com.fxiaoke.functions.tools.QueryOperator

Java example

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

Groovy example:

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

7. Fuzzy matching within the stringAllow

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| values ​​| Object | content |

return type

com.fxiaoke.functions.tools.QueryOperator

Java example

List criteria = Lists.newArrayList(Maps.of("name", Operator.LIKE("Easy Dynamic Sharing")));

Groovy example:

List criteria = [["name": Operator.LIKE("LIKE")]]

8. Remove fuzzy matching string content

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| values ​​| Object | content |

return type

com.fxiaoke.functions.tools.QueryOperator

Java example

List criteria = Lists.newArrayList(Maps.of("name", Operator.LIKE("Easy Dynamic Sharing")));

Groovy example:

List criteria = [["name": Operator.LIKE("LIKE")]]

9. Query data with intersection

If the data is [1,2,3] and the query condition is [1,4], it will be returned (because there is 1)
If the data is [1,2,3] and the query condition is [4,5], it will not return

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| list | List | content |

return type

com.fxiaoke.functions.tools.QueryOperator

Java example

List criteria = Lists.newArrayList(Maps.of("name", Operator.IN(Lists.newArrayList("Easy", "Funshare"))));

Groovy example:

List criteria = [["name": Operator.IN(["Easy", "FunShare"])]]

10. Query non-intersecting data

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

Parameter Description

parameter type description
list List content

return type

com.fxiaoke.functions.tools.QueryOperator

Java example

List criteria = Lists.newArrayList(Maps.of("name", Operator.NIN(Lists.newArrayList("Easy", "Funshare"))));

Groovy example:

List criteria = [["name": Operator.NIN(["Easy", "Funshare"])]]

11. The array field of the query data matches a subset of the input criteria

If the data is [1,2,3] and the query condition is [1,2], then return
If the data is [1,2,3] and the query condition is [3,4], it will not return

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| list | List | content |

return type

com.fxiaoke.functions.tools.QueryOperator

Java example

List criteria = Lists.newArrayList(Maps.of("name", Operator.CONTAINS(Lists.newArrayList("Easy", "Funshare"))));

Groovy example:

List criteria = [["name": Operator.CONTAINS(["Easy", "Sharing"])]]

12. The array field of the query data matches the data outside the subset of the input conditions

If the data is [1,2,3] and the query condition is [1,2], it will not return
If the data is [1,2,3] and the query condition is [3,4], then return

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| list | List | content |

return type

com.fxiaoke.functions.tools.QueryOperator

Java example

List criteria = Lists.newArrayList(Maps.of("name", Operator.NCONTAINS(Lists.newArrayList("Easy", "Funshare"))));

Groovy example:

List criteria = [["name": Operator.NCONTAINS(["Easy", "Share"])]]

13. Query any data matching any content of the array

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ------------------------------------- |
| list | List | array |

return type

com.fxiaoke.functions.tools.QueryOperator

Java example

List criteria = Lists.newArrayList(Maps.of("name", Operator.HASANYOF(Lists.newArrayList("Easy", "Share"))));

Groovy example:

List criteria = [["name": Operator.HASANYOF(["Easy", "Share"])]]

14. Query data that is not in the array

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| list | List | array |

return type

com.fxiaoke.functions.tools.QueryOperator

Java example

List criteria = Lists.newArrayList(Maps.of("name", Operator.NHASANYOF(Lists.newArrayList("Easy", "Share"))));

Groovy example:

List criteria = [["name": Operator.NHASANYOF(["Easy", "Share"])]]

15. Query the data with content in the data field (yes/no)

QueryOperator. EXISTS(<boolean exists>)

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| exists | boolean | yes/no |

return type

com.fxiaoke.functions.tools.QueryOperator

Java example

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

Groovy example:

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

16. Query the data starting with...

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| values ​​| Object | content |

return type

com.fxiaoke.functions.tools.QueryOperator

Java example

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

Groovy example:

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

17. Query data ending with...

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| values ​​| Object | content |

return type

com.fxiaoke.functions.tools.QueryOperator

Java example

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

Groovy example:

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

18. Query data in the range of...

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| list | List | range data |

return type

com.fxiaoke.functions.tools.QueryOperator

Java example

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

Groovy example:

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

Reference class com.fxiaoke.functions.model.FQLAttribute

field description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| columns | List | SELECT [field] |
| queryTemplate | QueryTemplate | WHERE [query condition], see QueryTemplate description for details |
| orderBy | Map | ORDER BY [sort field] eg ["create_time":1] |
| limit | Integer | LIMIT [number of queries] default 10, upper limit 100|
| skip | Integer | SKIP [page flip entry] |

Reference class com.fxiaoke.functions.model.SelectAttribute

field description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| dbSource | Boolean | Whether to directly query the DB, the default is No |
| currentIdentity | Boolean | Whether to query as the current user, default No |
| needRelevantTeam | Boolean | Whether to need a relevant team, the default is no |
| fillExtendInfo | Boolean | Whether to automatically fill __r fields, such as personnel information, not filled by default |
| needCount | Boolean | Whether to return the total number of matching conditions, default No |
| needCalculate | Boolean | Whether to execute the calculated field when querying, the default is |
| needInvalid | Boolean | whether to return invalid data, the default is no |
| needQuote | Boolean | Whether to calculate the reference field in real time, the default is |
| calculateCount | Boolean | Whether to calculate statistical fields in real time, the default is No |

Reference class com.fxiaoke.functions.tools.OutTeamMemberAttribute

1. Add external members

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| teamMemberList | List | Add external personnel list |
| permission | Permission | TeamMemberEnum.Permission.READONLY //Read only
TeamMemberEnum.Permission.READANDWRITE //Read and write
TeamMemberEnum.Permission.NO_PERMISSION //No permission |

return type

OutTeamMemberAttrixbut

Java example

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 example:

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. Add downstream enterprises

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| teamMemberList | List | List of Downstream Enterprises |
| permission | Permission | TeamMemberEnum.Permission.READONLY //Read only
TeamMemberEnum.Permission.READANDWRITE //Read and write
TeamMemberEnum.Permission.NO_PERMISSION //No permission |

return type

OutTeamMemberAttribute

Java example

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 example:

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. Add external roles

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| userIds | List | Role Id list |
| permission | Permission | TeamMemberEnum.Permission.READONLY //Read only
TeamMemberEnum.Permission.READANDWRITE //Read and write
TeamMemberEnum.Permission.NO_PERMISSION //No permission |

return type

OutTeamMemberAttribute

Java example

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

Groovy example:

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

4. Add downstream enterprise group

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| userIds | List | Enterprise Groups |
| permission | Permission | TeamMemberEnum.Permission.READONLY //Read only
TeamMemberEnum.Permission.READANDWRITE //Read and write
TeamMemberEnum.Permission.NO_PERMISSION //No permission |

return type

OutTeamMemberAttribute

Java example

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

Groovy example:

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

Reference class com.fxiaoke.functions.tools.TeamMemberAttribute

1. Add internal members

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| teamMembers | List | Employee IDList |
| role | Role | TeamMemberEnum.Role.OWNER //Responsible person
TeamMemberEnum.Role.FOLLOWER //Joint follow-up person
TeamMemberEnum.Role.SERVICE_STAFF //Service staff
TeamMemberEnum.Role.NORMAL_STAFF //Normal member
TeamMemberEnum.Role.NOT_EXIST //Not in it |
| permission | Permission | TeamMemberEnum.Permission.READONLY //Read only
TeamMemberEnum.Permission.READANDWRITE //Read and write
TeamMemberEnum.Permission.NO_PERMISSION //No permission |

return type

com.fxiaoke.functions.tools.TeamMemberAttribute

Java example

TeamMemberAttribute employTeamMember = TeamMemberAttribute.createEmployMember(
     Lists. newArrayList("1027"),
     TeamMemberEnum.Role.NORMAL_STAFF,
     TeamMemberEnum. Permission. READONLY);
employTeamMember.setIgnoreSendingRemind(true) // Optional parameter, whether to ignore sending CRM reminders. default false
employTeamMember.setRealtime(true) // Optional parameter, whether to take effect in real time. default false
APIResult employTeamResult = Fx.object.addTeamMember("object_qep6N__c", "61848edfd9007e00019ee222", employTeamMember);
log.info(employTeamResult);

Groovy example:

def employTeamMember = TeamMemberAttribute.createEmployMember(["1027"], TeamMemberEnum.Role.NORMAL_STAFF, TeamMemberEnum.Permission.READONLY)
employTeamMember.setIgnoreSendingRemind(true) // Optional parameter, whether to ignore sending CRM reminders. default false
employTeamMember.setRealtime(true) // Optional parameter, whether to take effect in real time. default false
def employTeamResult = Fx.object.addTeamMember("object_qep6N__c","61848edfd9007e00019ee222", employTeamMember)
log.info(employTeamResult)

2. Add user group members

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| teamMembers | List | User Group IDList |
| role | Role | TeamMemberEnum.Role.OWNER //The person in charge
TeamMemberEnum.Role.FOLLOWER //joint follow-up person
TeamMemberEnum.Role.SERVICE_STAFF //after-sales service staff
TeamMemberEnum.Role.NORMAL_STAFF //ordinary member
TeamMemberEnum.Role.NOT_EXIST //absent where |
| permission | Permission | TeamMemberEnum.Permission.READONLY //Read only
TeamMemberEnum.Permission.READANDWRITE //Read and write
TeamMemberEnum.Permission.NO_PERMISSION //No permission |

return type

com.fxiaoke.functions.tools.TeamMemberAttribute

Java example

TeamMemberAttribute employTeamMember = TeamMemberAttribute.createEmployMember(
                Lists. newArrayList("1027"),
                TeamMemberEnum.Role.NORMAL_STAFF,
                TeamMemberEnum. Permission. READONLY);
employTeamMember.setIgnoreSendingRemind(true) // Optional parameter, whether to ignore sending CRM reminders. default false
employTeamMember.setRealtime(true) // Optional parameter, whether to take effect in real time. default false
APIResult employTeamResult = Fx.object.addTeamMember(
                "object_qep6N__c",
                "61848edfd9007e00019ee222",
                employTeamMember);
log.info(employTeamResult);

Groovy example:

def employTeamMember = TeamMemberAttribute.createEmployMember(["1027"], TeamMemberEnum.Role.NORMAL_STAFF, TeamMemberEnum.Permission.READONLY)
employTeamMember.setIgnoreSendingRemind(true) // Optional parameter, whether to ignore sending CRM reminders. default false
employTeamMember.setRealtime(true) // Optional parameter, whether to take effect in real time. default false
def employTeamResult = Fx.object.addTeamMember("object_qep6N__c","61848edfd9007e00019ee222", employTeamMember)
log.info(employTeamResult)

3. Add department members

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| teamMembers | List | Department IDList|
| role | Role | TeamMemberEnum.Role.OWNER //Responsible person
TeamMemberEnum.Role.FOLLOWER //Joint follow-up person
TeamMemberEnum.Role.SERVICE_STAFF //After-sales service personnel
TeamMemberEnum.Role .NORMAL_STAFF //Ordinary member
TeamMemberEnum.Role.NOT_EXIST //Not in it |
| permission | Permission | TeamMemberEnum.Permission.READONLY //Read only
TeamMemberEnum.Permission.READANDWRITE //Read and write
TeamMemberEnum.Permission.NO_PERMISSION //No permission |

return type

com.fxiaoke.functions.tools.TeamMemberAttribute

Java example

TeamMemberAttribute deptTeamMember = TeamMemberAttribute.createDepartmentMember(
                Lists. newArrayList("1008"),
                TeamMemberEnum.Role.NORMAL_STAFF,
                TeamMemberEnum. Permission. READONLY);
deptTeamMember.setIgnoreSendingRemind(true) // Optional parameter, whether to ignore sending CRM reminders. default false
deptTeamMember.setRealtime(true) // Optional parameter, whether to take effect in real time. default false
APIResult deptTeamResult = Fx.object.addTeamMember("object_qep6N__c", "61848edfd9007e00019ee222", deptTeamMember);
log.info(deptTeamResult);

Groovy example:

def deptTeamMember = TeamMemberAttribute.createDepartmentMember(["1008"], TeamMemberEnum.Role.NORMAL_STAFF, TeamMemberEnum.Permission.READONLY)
deptTeamMember.setIgnoreSendingRemind(true) // Optional parameter, whether to ignore sending CRM reminders. default false
deptTeamMember.setRealtime(true) // Optional parameter, whether to take effect in real time. default false
def deptTeamResult = Fx.object.addTeamMember("object_qep6N__c","61848edfd9007e00019ee222", deptTeamMember)
log. info(deptTeamResult)

4. Add role members

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

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
|teamMembers | List | list of employee IDs |
| role | Role | TeamMemberEnum.Role.OWNER //Responsible person
TeamMemberEnum.Role.FOLLOWER //Joint follow-up person
TeamMemberEnum.Role.SERVICE_STAFF //After-sales service personnel
TeamMemberEnum.Role .NORMAL_STAFF //Ordinary member
TeamMemberEnum.Role.NOT_EXIST //Not in it |
| permission | Permission | TeamMemberEnum.Permission.READONLY //Read only
TeamMemberEnum.Permission.READANDWRITE //Read and write
TeamMemberEnum.Permission.NO_PERMISSION //No permission |

return type

com.fxiaoke.functions.tools.TeamMemberAttribute

Java example

TeamMemberAttribute roleTeamMember = TeamMemberAttribute.createRoleMember(
         Lists.newArrayList("00000000000000000000000000000009"),
         TeamMemberEnum.Role.NORMAL_STAFF,
         TeamMemberEnum. Permission. READONLY);
roleTeamMember.setIgnoreSendingRemind(true) // Optional parameter, whether to ignore sending CRM reminders. default false
roleTeamMember.setRealtime(true) // Optional parameter, whether to take effect in real time. default false
APIResult roleTeamResult = Fx.object.addTeamMember("object_qep6N__c", "61848edfd9007e00019ee222", roleTeamMember);
log.info(roleTeamResult);

Groovy example:

def roleTeamMember = TeamMemberAttribute.createRoleMember(["00000000000000000000000000000009"], TeamMemberEnum.Role.NORMAL_STAFF, TeamMemberEnum.Permission.READONLY)
roleTeamMember.setIgnoreSendingRemind(true) // Optional parameter, whether to ignore sending CRM reminders. default false
roleTeamMember.setRealtime(true) // Optional parameter, whether to take effect in real time. default false
def roleTeamResult = Fx.object.addTeamMember("object_qep6N__c","61848edfd9007e00019ee222", roleTeamMember)
log.info(roleTeamResult)
2022-11-23
0 0