Use with Screen Flow

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.

  • True ・・・ Gray
  • False ・・・ No color (default)
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.

  • True・・・Save file + download
  • False・・・Do not download
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.

  • blank・・・Download
  • file・・・Attached to the record as a file (File).
  • att・・・Attached to the record as a file (Attachment).
  • preview・・・・PDF preview

*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.

  • True ・・・ Success
  • False ・・・ Error
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)

 

 

NoteLimitations

  • 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

Output files and update Opportunity records in Salesforce Flow (for OFC Ver.2) – Office File Creator Advanced –

Output documents and update Opportunity from the List View in Salesforce Flow (for OFC Ver.2) - Office File Creator Advanced -

Create documents of selected records in the data table of a Flow in Salesforce

 

 

Troubleshooting