Output files using Office File Creator with the screen flow.
*This procedure is for Office File Creator ver.2. Ver.1 and Ver.2 have different settings. If you are using Ver.1, please refer to the Ver.1 version.
*Knowledge of flow creation is required. Inquiry support does not cover standard Salesforce functions such as how to create flows, flow errors, etc.
How to use with Screen Flow
- Place the ofcForFlowScreen component on the screen flow.
- The ofcForFlowScreen component returns return values such as isSuccess and errorMessage.
- Hide the flow footer since the ofcForFlowScreen component contains "Next" and "Previous" buttons.
- The ofcForFlowScreen component proceeds to the next flow process even if the output fails. To detect errors, include error handling that retrieves the return value of the isSuccess parameter and displays an error message in the event of an error.
Screen Properties: "Show Footer" checked off
ofcForFlowScreen Component property screen
Screen with "(Footer) Use Gray Background" set to False (default)
Screen with "(Footer) Use Gray Background" set to True
ofcForFlowScreen Component Parameters
Parameters | Setting details |
(Footer) Next Button Label | Set the label for the "Next" button that appears in the footer. The default is "Next". |
(Footer) Previous Button Label | Set the label for the "Previous" button that appears in the footer. |
(Footer) Use Gray Background | Set "True" to set the footer background color to gray. Default is False.
|
auto execute (option for Standard/Pro) | By setting "True", it will be executed automatically without clicking the "Next" button. When "True" is set, the footer ofcForFlowScreen component will not be displayed. Set to "True" if the ofcForFlowScreen component is executed within a flow loop process, such as changing the template according to record values during batch output.
*Option for Standard/Pro. |
download | If "file" or "att" is set to the "save" parameter, set "True" to download the file in addition to saving the file.
|
recordId | Record Id
*Multiple record Id's separated by commas are not allowed. |
recordId List | Set the record Id list. Set this variable for batch output of multiple files from the ListView or flow.
In flow, the variable is a text data type, and "Allow multiple values (collection)" is checked. If values are set for both "recordId" and "recordId List", "recordId" is used, and "recordId List" is ignored. |
save | Set the file output method.
*preview is available only for PDF. When downloading the file after previewing, the file name defaults to "OFCPdf.pdf" and the output file name set in the OFC_Template record is not applied. |
template | Template Api Name of the OFC_Template Record. |
ofcForFlowScreen Component Return Values (for single record output)
When the recordId parameter is set to a value, the return value is as follows.
Prameters | Result Values |
isSuccess | Returns the success or error of the file output result.
|
errorMessage | If isSuccess is False, it returns the error content. |
filename | File name (with extension) |
fileNameWithoutExtension | File name (without extension) |
fileExtension | File extension |
contentDocumentId | If the parameter ″save″ is "file", it returns the record Id of the ContentDocument object. |
contentDocumentVesionId | If the parameter ″save″ is "file", it returns the record Id of the ContentVersion object. |
attachmentId | If the parameter ″save″ is "att", it returns the record Id of the ContentVersion object. |
pdf preview url to get error details | This is the PDF preview URL when an internal error occurs in the PDF output. The preview may show more detailed errors. |
log Id | Returns the OFC_Log record Id. Returns the result if "Save Logs" is checked on the OFC_Template record.
*Log saving feature is available in OFC Pro. |
ofcForFlowScreen Component Return Values (For multiple record output)
When the recordId List parameter is set to a value, the return value is as follows.
Prameters | Result Values |
(Batch) successIdList | Returns a list of record Id's for which file output succeeded. |
(Batch) errorIdList | Returns a list of record Id's for which file output failed. |
(Batch) logIdList | Returns a list of OFC_Log record Id. Returns the result if "Save Logs" is checked on the OFC_Template record.
*Log saving feature is available in OFC Pro. |
(Batch) totalCount | Returns the number of processes. |
(Batch) successCount | Returns the number of successes. |
(Batch) errorCount | Returns the number of errors. |
(Batch) errorMessages | Returns error messages. |
Flow Example
Output from List View
Lightning Web Security must be enabled when the flow is executed in the list view. From Setup > Session Settings, check enable/disable "Use Lightning Web Security for Lightning web components and Aura components".
About Enabling Lightning Web Security
- Before enabling Lightning Web Security in the production organization, it is necessary to confirm in the Sandbox that programs and managed packages in the organization are not affected.
- About enabling Lightning Web Security, ask your organization's system administrator or Salesforce help.
For organizations that cannot enable Lightning Web Security, an alternative is to run the flow with the data table on the application page.
Create documents of selected records in the data table of a Flow in Salesforce
Reference
How to deal with a CORS error when executing a flow in a list view and the process does not proceed
Enablement of Lightning Web Security Begins
Secure Your Components Better, Stronger, Faster with Lightning Web Security (Generally Available)
Note・Limitations
- Office File Creator cannot be used in a Record-Triggered Flow.
- Output from screens containing custom development other than record screens (standard) and list views is not supported.
- Knowledge of flow creation is required. Inquiry support does not cover standard Salesforce functions such as how to create flows, flow errors, etc.
Reference
Create documents of selected records in the data table of a Flow in Salesforce
Troubleshooting
- Screen Flow terminates without outputting a file after execution.
- File output processing does not start after the execution in Screen Flow.
- When a Screen Flow is executed in the list view, it does not proceed from the processing screen.
- When executing a Screen Flow from the list view or the flow debug screen, the error message "Failed to read static resource OFC_Zip. Please clear your browser cache and try again." is displayed.