Skip to main content

Get workflow document data (JSON format) in Salesforce

Convert altaFlow document data to JSON using Salesforce Flow Builder. Learn how to configure Apex actions, set up custom buttons, and streamline processing.

Using this Apex class in Salesforce Flow Builder, administrators can access and convert data from altaFlow workflows into JSON format in Salesforce. This allows for easier and more organized document data processing.

Tip: Before starting, ensure a smooth process by following these steps:

1. Create a text field in the Salesforce object (for example, Account) to store the Document ID.

2. In the altaFlow workflow, use the Invoke Salesforce process bot to populate the Document ID field in Salesforce.

Now, letโ€™s proceed to configuring the Salesforce Flow.

1. In Salesforce Setup, navigate to Flows, then New Flow, and choose Screen Flow.

Salesforce Setup Flows page with New Flow and Screen Flow option selected

2. Click the plus icon, choose Action, and search for the needed Apex action.

Salesforce Flow Builder Add Action menu searching for altaFlow Apex action

Enter a label and API name (auto-generated) for the Action. Then, provide the ID of the document from which the data will be pulled.

altaFlow Get workflow document data action setup with label and Document ID input

Optionally, you can also define a specific revision of the source document. To specify a document revision, enable the toggle switch and enter the relevant revision ID.

altaFlow Apex action settings with document revision toggle and revision ID field

3. Configure the modal window to display the parsed data by adding a Screen element. Enter the label and API name (auto-generated).

Salesforce Flow Builder Screen element configuration with label and API name fields

Locate the Display Text component in the left sidebar, then drag and drop it onto the canvas. Then, search for the following variables in the element properties panel by starting to enter get:

Variable

Description

{!Get_workflow_document_data.json}

This variable retrieves JSON data from the selected document.

Display Text component in Salesforce Flow with altaFlow JSON output variable

Variable

Description

{!Get_workflow_document_data.error}

This variable displays error messages. Use red text to highlight these messages for better visibility.

Display Text component in Salesforce Flow with altaFlow error variable highlighted in red

Save your settings by selecting Done. Then, save and activate the Salesforce Flow.

4. Create a custom action to generate a button for accessing document data. Navigate to Object Manager, then select Object (Account). Go to Buttons, Links, and Actions, then click New Action.

Salesforce Object Manager Buttons Links and Actions page with New Action button

Choose Flow as the action type, and select the Salesforce Flow you created. Add the label and API name (auto-generated) for the custom action.

Salesforce New Action setup with Flow type and altaFlow document data Flow selected

Next, go to Account โ†’ Page Layouts โ†’ Account Layout โ†’ Mobile and Lightning Actions. Drag and drop the custom button with the access to document data onto the Salesforce Mobile and Lightning Experience Actions canvas.

Salesforce Account Page Layout editor with custom action dragged to Mobile and Lightning Actions

6. In Salesforce, go to Admin Tools, then Custom buttons. Create a button connected to the altaFlow workflow with the Invoke Salesforce Process bot.

Process overview:

1. Administrators should initiate the workflow to transfer and store the Document ID in the Document ID field of the Account record.

2. Users can click the custom action button to generate a JSON of document fields, which retrieves data into Salesforce.


The generated JSON-format text will appear as follows:

JSON-format output of altaFlow document data displayed in Salesforce after running custom action

In case of any errors, Salesforce administrators will receive immediate email notifications.

Did this answer your question?