English
Fx.checkins
About 1077 wordsAbout 4 min
2026-01-09
1. Create Outbound Plan
Create Outbound Plan
Fx.checkins.createPlan(<CreatePlanArg arg>)
Request parameters
Request Body
| Parameter Name | Parameter Type | Description | Required |
|---|---|---|---|
| arg | CreatePlanArg | Y |
| arg | CreatePlanArg | Description | Required |
|---|---|---|---|
| executorId | string | Field executor ID | Y |
| planTime | integer | Field plan time | Y |
| checkTypeId | string | Field type ID | Y |
| mainObjList | List[ObjectInfo] | Primary objects for field work | -- |
| userId | string | Creator information | Y |
| assistantIds | List[integer] | Assistant personnel list | -- |
| referenceObject | List[ObjectInfo] | Secondary objects for field work | -- |
| extFields | Map | Custom field API names and values | -- |
| mainObjList | ObjectInfo | Description | Required |
|---|---|---|---|
| dataId | string | Object ID | Y |
| apiName | string | Object API name | Y |
| name | string | Object name | Y |
| info | string | Address | -- |
| objName | string | Primary attribute | Y |
| recordType | string | Business type API name | -- |
| recordTypeName | string | Business type name | -- |
| showRecordTypeName | string | Display business type | -- |
| referenceObject | ObjectInfo | Description | Required |
|---|---|---|---|
| dataId | string | Object ID | Y |
| apiName | string | Object API name | Y |
| name | string | Object name | Y |
| info | string | Address | -- |
| objName | string | Primary attribute | Y |
Return Parameters
| Parameter Name | object | Description |
|---|---|---|
| checkinId | string | The ID of the field assignment |
Return an example
{
"checkinId":""
}Code examples
List userId = context.data.owner as List //Account owner
String accountId = context.data._id as String //Account ID
String name = context.data.name as String //Account name
String location = context.data.location as String //Account detailed address (optional for other objects)
//Visit time: current time +5 days (can be set to any future time)
DateTime nowDate=DateTime.now()+5.days
// Construct main field visit object data
Map mainObject=[:]
mainObject.put("dataId", accountId) //Data ID
mainObject.put("apiName", "AccountObj") //Object API name
mainObject.put("objName", "Account") //Object display name
mainObject.put("name", name) //Primary attribute
mainObject.put("info", location) //Account address
mainObject.put("remark", "Visit account as scheduled") //Field visit description
mainObject.put("recordType", "default__c") //Business type API name
mainObject.put("recordTypeName", "Default Business Type") //Business type display name
mainObject.put("showRecordTypeName", true) //Display business type
List mainObjList = [mainObject]
// Construct reference object data (optional, depends on business scenario)
Map referenceObject=[:]
referenceObject.put("dataId", "6218471c80406d000163b57e") //Data ID
referenceObject.put("apiName", "object_CE1O0__c") //Object API name
referenceObject.put("objName", "Haizi Function Template Library") //Object display name
referenceObject.put("name", "asaas") //Primary attribute
List referenceObjectList = [referenceObject]
Map paramField=[:] //Input parameters
paramField.put("userId", userId[0]) //Creator ID
paramField.put("checkTypeId", "62173855e0eff651e2253c86") //Visit type ID (default_check_type_id for standard visits)
paramField.put("planTime", nowDate.toTimestamp()) //Scheduled execution timestamp
paramField.put("executorId", userId[0]) //Executor ID
paramField.put("assistantIds", []) //Associate visitor IDs (optional)
paramField.put("mainObjList", mainObjList)
paramField.put("referenceObject", referenceObjectList)
Map extFields = [:]
extFields.put("field_4K9Zd__c","Custom field value") //Custom field assignment (optional)
paramField.put("extFields",extFields)
log.info("New field visit parameters:"+paramField)
def (Boolean createPlan_error,Map createPlan_data,String createPlan_errorMessage) = Fx.checkins.createPlan(paramField)
if(!createPlan_error){
log.info("Creation successful, visit ID:" + createPlan_data["checkinId"] as String)
}else{
log.info("Creation failed, reason:" + createPlan_errorMessage)
}Notice
- Reference for the info field in ObjectInfo: 116.331642#%39.97884#%Haidian District, Zhongguancun East Road, Beijing
2. Delete Advanced Field Service
Fx.checkins.delCheckins(<string checkinsId>)
Request parameters
Request Body
| Parameter Name | object | Description | Required |
|---|---|---|---|
| checkinsId | string | Field work type ID | Y |
Code examples
def (boolean error, String data, String errorMessage) = Fx.checkins.delCheckins("attendanceId");
if(error){
log.info("delCheckins error response: " + errorMessage)
}else{
log.info("delCheckins succeeded")
}3. Update Advanced Field Customization Fields
Update Advanced Field Customization Fields
Fx.checkins.editExtFields(<int operatorUserId>, <string checkinsId>, <Map extFieldMap>)
Request parameters
Request Body
| Parameter Name | object | Description | Required |
|---|---|---|---|
| operatorUserId | int | Operator user ID | Y |
| checkinsId | string | Fieldwork ID | Y |
| extFieldMap | Map | Fields to be updated and their corresponding values (Only custom fields are supported) | Y |
Code examples
Map extFieldMap = ["field_cM25i__c":5.6] // Fields to update and their values (only custom fields are supported)
def (boolean error, Map data, String message) = Fx.checkins.editExtFields(1000,"67d3dd964036d37c62ac4e75",extFieldMap);
if(error){
log.info("editExtFields error response:" + message)
}else{
log.info("editExtFields succeeded")
}4. Batch Update Advanced Field Service Custom Fields
Fx.checkins.batchUpdateFields(<List checkinsIds>, <Map extFields>)
Request parameters
Request Body
| Parameter Name | object | Description | Required |
|---|---|---|---|
| checkinsIds | List[string] | Y | |
| extFields | Map | Y |
Code examples
Map extFieldMap = ["field_cM25i__c":5.8] // Fields to update and their values (only custom fields are supported)
List checkIds = ["67d3dd964036d37c62ac4e75","67d3dd544036d37c62ac4e6d"]
def (boolean error, Map data, String message) = Fx.checkins.batchUpdateFields(checkIds,extFieldMap);
if(error){
log.info("batchUpdateFields error response:" + message)
}else{
log.info("batchUpdateFields succeeded")
}Notice
- Not synchronized with the advanced field service object. It only takes effect in the field service calendar. To synchronize with the object, please use the single-update function.
5. Query Employee Field Attendance Records
Query Employee Field Attendance Records (Including Advanced Field Attendance & Regular Field Attendance)
Fx.checkins.getCheckinsDataList(<integer pageNum>, <integer pageSize>, <long startTime>, <long endTime>, <List userIds>)
Request parameters
Request Body
| Parameter Name | object | Description | Required |
|---|---|---|---|
| pageNum | integer | Page number (Nth page) | Y |
| pageSize | integer | Items per page | Y |
| startTime | long | Start time (in milliseconds) | Y |
| endTime | long | End time (in milliseconds) | Y |
| userIds | List[integer] | User IDs | Y |
Return Parameters
| Parameter Name | CheckData | Description |
|---|---|---|
| total | integer | |
| checkDatas | List[CheckDataDetail] |
| checkDatas | CheckDataDetail | Description |
|---|---|---|
| ownerAccount | string | Responsible person E.g. Employee ID |
| checkinsId | string | Field check-in ID |
| checkinsTimeStamp | integer | Check-in timestamp |
| checkinsLon | number | Check-in longitude coordinate |
| checkinsLat | number | Check-in latitude coordinate |
| feedId | integer | Feed ID |
| checkinsAddressDesc | string | Check-in location name/description |
| ruleId | string | Check-in rule ID |
| contentText | string | Check-in content |
| newCustomerId | string | Associated customer ID |
| checkinsDistnace | integer | Distance to associated customer |
| cheatRisk | integer | Cheating risk: 0- Normal, 1- iOS jailbreak, 2- Android cheating software, 3- Android spoofed location |
| cheatRiskDesc | string | Device risk description |
| distanceRisk | boolean | Abnormal distance |
| deviceRisk | boolean | Abnormal device |
| checkOutTime | integer | Check-out time |
| checkOutLat | number | Check-out latitude coordinate |
| checkOutLon | number | Check-out longitude coordinate |
| checkOutAddressDesc | string | Check-out location name/description |
| mainObjectInfo | object | Main object information |
| checkTypeId | string | Field check-in type ID |
| deviceId | string | Device ID |
| imageFiles | array[object] | Image information |
Code examples
def (Boolean error, Map data, String errorMessage) = Fx.checkins.getCheckinsDataList(1, 20, 1645750400000, 1741944322442, [1000])
if(error){
log.info("getCheckOfficeDataList is error Response:" + errorMessage)
}else{
log.info(data)
}6. Query Advanced Field Master-Detail Object Information
Fx.checkins.getVisitObjInfoById(<string checkId>)
Request parameters
Request Body
| Parameter Name | object | Description | Required |
|---|---|---|---|
| checkId | string | Fieldwork ID | Y |
Return Parameters
| Parameter Name | object | Description |
|---|---|---|
| mainObjInfo | ObjectInfo | |
| referenceObject | List[ObjectInfo] |
Code examples
def(Boolean error, Map data, String errorMessage) = Fx.checkins.getVisitObjInfoById("67d3dd544036d37c62ac4e6d")
if(!error){
log.info("ret:" + data)
}else{
log.info("Function execution exception:" + errorMessage)
}7. Resynchronize Advanced Field Data
Fx.checkins.syncCheckins(<List checkIdList>, <boolean isInterconnect>, <string syncMode>)
Request parameters
Request Body
| Parameter Name | object | Description | Required |
|---|---|---|---|
| checkIdList | List[string] | Y | |
| isInterconnect | boolean | Whether it is interconnection | Y |
| syncMode | string | Synchronization mode (defaults to check_obj_add if not specified) | -- |
Code examples
List checkIds = ["67d3dd964036d37c62ac4e75"]
def (Boolean error, List data, String errorMessage) = Fx.checkins.syncCheckins(checkIds, false)
if(error){
log.info("syncCheckinsData is error Response: " + errorMessage)
}else{
log.info(data)
}Notice
- syncMode parameter value range
- check_obj_add Add
- check_obj_edit Edit
- check_finish Complete
