English
Fx.template
About 213 wordsLess than 1 minute
2026-01-09
1. print Use object print templates to output print files
Generate print documents based on template ID and data ID
Fx.template.print(<boolean error>, <Email data>, <String errorMessage>)
Request parameters
Request Body
| Parameter Name | object | Description | Required |
|---|---|---|---|
| error | boolean | Whether execution encountered an exception | Y |
| data | Return result | Y | |
| errorMessage | String | Error message | Y |
| data | Return result | Required | |
|---|---|---|---|
| path | String | NPath | Y |
| fileSize | Integer | File size | Y |
| name | String | File name | Y |
| fileType | String | File type | Y |
Return Parameters
| Parameter Name | APIResult | Parameter list |
|---|---|---|
| error | boolean | Indicates whether execution encountered an exception |
| data | Return result | |
| errorMessage | String | Exception message |
Return an example
{
"error": false,
"data": {},
"errorMessage": ""
}Code examples
// Object API Name for printing data
String objectAPIName = "object_kFc8w__c"
// Data ID to print
String objectId = "6209cfbcdac8a0000127187f"
// Template ID
String templateId = "64d5dae417eb092ee3bbd9b1"
// Process instance ID
String instanceId = null
// Document output orientation
String orientation = "Landscape"
// Language tag
String locale = "zh-CN"
def(Boolean error, Map data, String errorMessage) = Fx.template.print(objectAPIName, objectId, templateId, instanceId, orientation, locale)
if (error) {
Fx.log.info("Print error: " + errorMessage)
} else {
Fx.log.info(Fx.json.toJson(data))
}Notice
- Printing may take a long time, so it is recommended to place it after process actions or within asynchronous functions to avoid page execution timeouts.
