4.4 [Function Components] Interface Capability is Enabled in Data Intermediate Table

Custom functions can insert/modify/query data mapping table
Function examples are as follows:
Map header=[:] //Create data mapping Map param1=["ployDetailId":"155bd981457343f291e0edc13776217f",//policy detail id, if the policy is deleted and rebuilt, it needs to be changed here "sourceObjectApiName": "AccountObj",//source object apiName, if the object apiName changes, it needs to be changed here "destObjectApiName": "BD_Customer.BillHead",//The target object apiName (virtual), if the object apiName changes, it needs to be changed here "sourceDataId": "sourceDataId123",//source object data id "destDataId": "destDataId123666",//target object data id "sourceDataName": "sourceDataName3666", //source object data name attribute "destDataName": "destDataName66",//target object data name attribute "remark": "remark1341"];//remark def result1=Fx.proxy.callAPI("erp.syncData.createSyncDataMapping", header, param1); //[false, HttpResult(statusCode=200, content={"errCode":"s106240000","errMsg":"success"}, bytes=null), ] s106240000 succeeds, others fail log.info(result1)
//Update the target object data id according to the source object data id
Map param2=["sourceObjectApiName":"AccountObj",//source object apiName, if the object apiName changes, it needs to be changed here
"destObjectApiName": "BD_Customer.BillHead",//The target object apiName (virtual), if the object apiName changes, it needs to be changed here
"sourceDataId": "sourceDataId123",//source object data id
"destDataId":"destDataId123666"]//target object data id
def result2=Fx.proxy.callAPI("erp.syncData.updateSyncDataMapping", header, param2);
//[false, HttpResult(statusCode=200, content={"errCode":"s106240000","errMsg":"success"}, bytes=null), ] s106240000 succeeds, others fail
log. info(result2)
//Query whether the source object data id has a mapping relationship
Map param3=["sourceObjectApiName":"AccountObj",//source object apiName, if the object apiName changes, it needs to be changed here
"destObjectApiName": "BD_Customer.BillHead",//The target object apiName (virtual), if the object apiName changes, it needs to be changed here
"sourceDataId":["sourceDataId123"]]//source object data ids, List
//If you need to query whether the target object data id has a mapping relationship, change sourceDataId to destDataId, if both are passed, it will only be queried according to the source data id
def result3=Fx.proxy.callAPI("erp.syncData.getSyncDataMappingBySourceDataId", header, param3);
// [false, HttpResult(statusCode=200, content={"data":{"sourceDataId123":
//{"sourceDataId":"sourceDataId123","isCreated":true,"destDataId":"destDataId123666","sourceDataName":"sourceDataName1233","updateTime":1611047455451,"lastSyncStatus":6,
//"destDataName":"destDataName123","destTenantId":"81138","sourceObjectApiName":"AccountObj","destObjectApiName":"BD_Customer.BillHead","sourceTenantId":"81138",
//"statusName":"Added successfully","id":"aa46ed320312476485e932a1ca4b4263","lastSyncDataId":"92c86fb175254e54b990bd86b6ce1145","status":1}},"errCode":"s106240000","errMsg":success "}, bytes=null), ]
//s106240000 succeeds, others fail
//data is a Map, which stores data with a mapping relationship, key is the source data id, and value is the existing corresponding relationship.
log. info(result3)
Custom function to create a new erp field mapping table
//The legal values ​​of channel are ERP_K3CLOUD, ERP_SAP, ERP_U8, OA, STANDARD_CHANNEL //"dataType":"employee" indicates that the new one is an employee //dataCenterId is the data center id //fsDataId is the data id on crm. For personnel, here is the employee ID, not the data id of the crm personnel object. //erpDataId is the data id on erp //fsDataName is the data name of crm //erpDataName is the data name on erp
Map data = ["dataCenterId":"data center id", "channel":"ERP_K3CLOUD","dataType":"employee", "fsDataId": "fsDataId","fsDataName":"fsDataName","erpDataId":"erpDataId","erpDataName":"erpDataName"];
def ret = Fx.proxy.callAPI("erp.syncData.createErpfieldmapping", [:], data); Fx.log.info("ret is : "+ret)
2023-02-23
0 0