Generating documents from Salesforce flows

Once you have installed the Inkit Salesforce package and inserted your API key into the app, you can automatically generate documents from your Salesforce flows. In this tutorial, we will show you how to generate a proposal whenever you update the Stage field of a Sales Opportunity to Proposal/Price Quote.

The tutorial includes the following steps:

  1. Create a template and copy its ID.
  2. Create a Salesforce flow.
  3. Trigger a Salesforce flow.
  4. Put it all together.

Creating a template and copying its ID

Before you can create a Salesforce flow and trigger it, you need to create an Inkit template for the proposal and embed the Salesforce fields into it. To use this template in your Salesforce flow, copy the ID of the template from the Inkit web app by selecting Templates in the left sidebar and then clicking the copy button by the template whose ID you want to copy.

Creating a Salesforce flow

To create a Salesforce flow that will automatically generate a proposal from the Inkit template you created, do the following:

  1. In Salesforce, click the settings gear and then click Setup.

  2. In the Setup page, enter flows in the Quick Find field and click Flows under Process Automation.

  3. In the Flows panel, click New Flow.

  4. In the New Flow dialog box, select Record-Triggered Flow and click Create.

    Note: You can trigger the generation of Inkit documents in other ways, such as on a regular schedule.

  5. In the Configure Start dialog box, select Opportunity from the Object dropdown box.

    Then, choose A record is updated for the Trigger the Flow When option and set the Condition Requirements to All Conditions Are Met (AND).

    Next, under the Condition Requirements, set the Field to StageName, the Operator to Equals and the Value to Proposal/Price Quote.

    Finally, click Done.

    Note: While we have configured the flow for our proposal this way, you have many options for doing this in your own flows. For example, you could trigger the generation of a document when a Salesforce record is deleted and create a set of conditions for its generation.

  6. In the Flow Builder, click the + button to add an element to the flow.

  7. In the Add Element panel, click the Action interaction.

  8. In the New Action dialog box, select Generate Documents in the Action dropdown box.

    Next, enter a Label such as Generate Proposal and paste the template ID that you previously copied into Template Id.

    Note: If you scroll to the bottom of the New Action dialog box, you can optionally change the Document Name. By default the name of the document generated is the same as the template name.

    From the Record Id dropdown box, click $Record Opportunity.

    Then select Id.

    Finally, click Done.

  9. To save the flow, click Save.

    In the Save the flow dialog box, enter a Flow Label such as Generate Proposal and click Save.

  10. To activate the flow, click Activate.

Triggering a Salesforce flow

Once you've created a Salesforce flow for the proposal, you can generate a document from it by setting the Stage of a Sales Opportunity to Proposal/Price Quote. To to this:

  1. Click the App Launcher.

    In the Search apps and items... field, enter sales and click the Sales app.

  2. In the Sales page, click the Opportunities tab and click on an Opportunity Name.

  3. In the Opportunity page, select the Details tab and change Stage to Proposal/Price Quote, and then click Save.

Putting it all together

The following is a simple DOCX template proposal with Salesforce fields, which you can download and modify:

After you have created a template from this and copied its ID, created a Salesforce flow to the ID and triggered the flow, Inkit will generate a document similar to the following: