Fx.function: function call related API
1. Execute the controller function synchronously
Fx.function.executeFunc(<String functionApiName>, <Map param>)
Parameter Description
| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| functionApiName | String | The function apiName that needs to be executed |
| param | Map | The parameters passed in when executing the function |
return type
APIResult
Return value description
Object
Java example
Map keyValue = Maps.of(
"key1", "value1",
"key2", "value2"
);
Map param = Maps.of(
"map", keyValue
);
final APIResult ret = Fx.function.executeFunc("funcCalled__c", param);
Fx.log.info(ret.getData());
Groovy example
Map keyValue = [
"key1": "value1",
"key2": "value2"
]
Map param = [
"map":keyValue
]
def (error,result,errorMessage) = Fx.function.executeFunc("funcCalled__c",param)
Fx.log.info(result)
2. Execute the controller function asynchronously
Fx.function.executeAsyncFunc(<String functionApiName>, <Map param>)
Parameter Description
| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| functionApiName | String | The function apiName that needs to be executed |
| param | Map | The parameters passed in when executing the function |
return type
APIResult
Return value description
String
Java example
Map keyValue = Maps.of(
"key1", "value1",
"key2", "value2"
);
Map param = Maps.of(
"map", keyValue
);
final APIResult ret = Fx.function.executeAsyncFunc("funcCalled__c",param);
Fx.log.info(ret.getData());
Groovy example
Map keyValue = [
"key1": "value1",
"key2": "value2"
]
Map param = [
"map":keyValue
]
def (error,result,errorMessage) = Fx.function.executeAsyncFunc("funcCalled__c",param)
Fx.log.info(result)
3. Sequential execution of asynchronous controller functions
Fx.function.executeOrderlyAsyncFunc(<String functionApiName>, <Map param>)
Parameter Description
| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| functionApiName | String | The function apiName that needs to be executed |
| param | Map | The parameters passed in when executing the function |
return type
APIResult
Return value description
String, background asynchronous task Id
Java example
Map keyValue = Maps.of(
"key1", "value1",
"key2", "value2"
);
Map param = Maps.of(
"map", keyValue
);
final APIResult ret = Fx.function.executeOrderlyAsyncFunc("funcCalled__c",param);
Fx.log.info(ret.getData());
Groovy example
Map keyValue = [
"key1": "value1",
"key2": "value2"
]
Map param = [
"map":keyValue
]
def (error,result,errorMessage) = Fx.function.executeOrderlyAsyncFunc("funcCalled__c",param)
Fx.log.info(result)
4. Execute the controller function regularly
Fx.function.ontimeFunc(<String functionApiName>, <Map param>, <String runTime>)
Parameter Description
| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| functionApiName | String | The function apiName that needs to be executed |
| param | Map | The parameters passed in when executing the function |
| runTime | String | Timing execution time |
return type
APIResult
Return value description
String, background asynchronous task Id
Java example
Map keyValue = Maps.of(
"key1", "value1",
"key2", "value2"
);
Map param = Maps.of(
"map", keyValue
);
final APIResult ret = Fx.function.ontimeFunc("funcCalled__c",param,"100");
Groovy example
Map keyValue = [
"key1": "value1",
"key2": "value2"
]
Map param = [
"map":keyValue
]
def (error,result,errorMessage) = Fx.function.ontimeFunc("funcCalled__c",param,"2021-05-03 00:00:00")