Expanding Power Automate Series: Send an envelope through a custom Power App

In this blog post, I’ll explore how to use Microsoft Power Apps to create a custom mobile application to pre-populate envelope information through the DocuSign Connector for Microsoft Power Automate. For the first post in this series, see Expanding Power Automate Series: Send an envelope.

Users of Power Automate may already be aware of how valuable of a tool it is in streamlining business processes by creating custom automated workflows. With Power Apps, users can write applications to transform paper-based, manual business processes to paperless, digital experiences. 

Best of all, Power Apps offers a low-code environment so business users can build apps without the intervention of a professional developer. Build seamless intake forms to pre-populate documents before collecting signatures, or launch DocuSign eSignature workflows with the click of a button.

Let’s go ahead and see how it works!

Example: Create an app to pre-populate an envelope and tabs

In this example, the Power Automate workflow is triggered when a button is clicked in Power Apps after entering a recipient’s information. Once the workflow is triggered, the prebuilt DocuSign connector in Power Automate will read the recipient data input from Power Apps and send for signature. 

This workflow can be applied to various use cases to meet specific business needs.

Some examples:

  • In real estate, when a leasing agent prepares an agreement for a new tenant, the tenant could input their information in a Power App and receive pre-populated documents ready for signature.
  • In healthcare, when a patient checks in for an appointment or fills out hospital discharge paperwork, they could input their information in a Power App and receive pre-populated documents ready for signature.

The final app and workflow should look like this:

Final app mockup with associated Power Automate workflow

Step 1: Create a Power App and initialize variables

  1. Log in to Power Apps.
  2. Create a new Blank Canvas App and choose the format type. For this example, choose the Phone format. PowerAutomate: Creating a new Blank Canvas app
  3. Expand the left-hand menu bar, select Power Automate, and select Create New Flow. Power Automate: Selecting Create New Flow
  4. Select Create From Blank. Power Automate: Select Create From Blank
  5. Enter a name for the Flow. Notice that Power Apps has automatically been selected to trigger the Flow. Power Automate: Enter a name for the Flow
  6. Add New Step: Select the variable action Initialize Variable.

    Quick Tip! Select the three dots and Rename this step according to the variable name (for example, Signer Name) before filling out any of the required fields. This will properly name the variable’s Dynamic Content value later on. If the step is not renamed, the value will automatically be named as “InitializeVariable_Value.”

    • Enter the variable Name. 
    • Use the Type drop-down menu and select String as the variable type.
    • Click in the Value field and select Ask in PowerApps from the Dynamic Content list. This will allow us to pass in a parameter associated with this variable in Power Apps.
    • Repeat these steps to initialize variables for the Signer Title and Email. Power Automate: Select the variable action Initialize Variable

Step 2: Create the DocuSign envelope flow

  1. Add New Step: With the DocuSign Connector for Power Automate, select the Action Create Envelope.
    • Select a DocuSign account from the drop-down menu. If there are none available, authenticate with DocuSign by selecting the three dots, then +Add new connection. Proceed to log in to your DocuSign account.
    • Enter an email subject and optional text for the email body. Power Automate:Select the Action Create Envelope

At this point, you will be adding a document to send for signature. For this example, I will retrieve a document stored in SharePoint, but it may be from any source depending on the use case.

  1. Add New Step: Select the SharePoint action Get file content using path.
    • Select the Site Address from the drop-down menu.
    • Enter the File Path for the desired SharePoint document to be sent and signed. (See Flow Example - Create an Envelope for more on adding SharePoint documents to an envelope.) Power Automate: Get file content using path
  2. Add New Step: Select the DocuSign action Add documents to an envelope.
    • Select the Account from the drop-down menu.
    • Select the Envelope ID from the Dynamic Content list.
    • DocuSign APIs require that the document file you add to the flow be Base64-encoded. To add the results of the Get file content using path step, click in the document Base64 field.
    • In the Dynamic Content list, select the Expression tab, enter base64(body('Get_file_content_using_path')) and press OK.
    • Select the document type from the drop-down menu: in this case, docx.
    • Enter the document name. Power Automate: Add documents to an envelope
  3. Add New Step: Select the DocuSign action Add recipient to an envelope.
    • Select the Account from the drop-down menu.
    • Click in the Envelope field and select Envelope ID from the Dynamic Content list.
    • Click in the Signer Name field and select the signerName variable from the Dynamic Content list. This will allow us to pre-populate the envelope recipient information with input from the Power Apps user so that they can receive and sign the envelope.
    • Click in the Signer Email field and select the signerEmail variable from the Dynamic Content list.
    • In this example, you will not be assigning a signing order, so it is left blank. Power Automate: Add recipient to an envelope

At this point, you will now pre-populate fields (also referred to as tabs) in the document with data from Power Apps.

  1. Add New Step: Select the DocuSign action Add tabs for a recipient. This allows DocuSign to detect where to place the signature field on the document through a text placeholder referred to as an anchor string, or AutoPlace Text. This text is often colored white so that it remains invisible to the end user, but detectable by DocuSign. (See Configure a Document for Adding Tabs to create anchor strings.)

    Quick Tip! Rename this step to indicate which tab is being added (such as Name, Title, Date, or Signature). This will make it easier to identify which tab this step is addressing when the step views are collapsed or if any errors occur in the flow.

    • Select the Account from the drop-down menu.
    • Select the Envelope ID from the Dynamic Content list.
    • Select the Recipient ID from the Dynamic Content list. 
    • Select the Tab type from the drop-down list. Choose the tab type Text for the Signer’s Name.
    • In the tabs anchor string field, enter the same value as the AutoPlace Text in the document. IMPORTANT: If the tabs anchor string does not match the AutoPlace Text in the document, DocuSign will not be able to detect where to place the tab, and this step will fail. Power Automate: Add AutoPlace Text to the document
    • Adjusting the X and Y offsets is optional.
    • Click in the tabs value field and select the signerName variable from the Dynamic Content list. This will pre-populate this tab value with text input from Power Apps. Power Automate: Pre-populate the signerName tab value
  2. Add New Step:
    • Repeat Step 11 to assign the signerTitle variable to the Title tab type.
    • Repeat Step 11 to add the Signature tab type. 
    • Optional: Repeat Step 11 to add the Date Signed tab type.

      Note: There will be no tabs value field for the Signature or Date Signed tab type, as the date is automatically added and the signature must be entered at the time of signing.

      Power Automate: Pre-populating values for title, signature, and date
  3. Add New Step: Select the DocuSign action Send envelope.
    • Select the Account from the drop-down menu.
    • Click in the Envelope field and select Envelope ID from the Dynamic Content list. Power Automate: Select the DocuSign action Send envelope
  4. Select Save and navigate back to Power Apps.

Step 3: Tie everything together!

  1. Now back in the Power Apps environment, select Insert in the top menu bar and then select Label.
    • Change the Text value of this label to “Name.” This can be done in either the top function bar or through the Text property in the right-hand menu. Power Automate: Creating a label for the Name field
  2. Select Input from the top menu bar and select Text input from the drop-down menu.

    Quick Tip! Select the text input bar. Notice the element name has been highlighted in the left-hand Tree view. Click the three dots on this element and Rename this element to match the text label. In this case, “Name.” This will enable you to identify this element easily later on when you refer to this input’s value to trigger the Flow.

    • Optional: Remove the “Text input” text inside the input bar. Power Automate: Creating the Name text input field
  3. Repeat Steps 22-23 to create Title and Email text input fields. Power Automate: Adding the Title and Email fields
  4. Select Button from the top menu bar. 
    • Enter Submit in the Text property on the right-hand menu. 
    • Position this button below the text input fields. Power Automate: Adding the Submit button
  5. Select the newly created Submit button.
    • Select OnSelect from the drop-down menu in the upper left-hand corner.
    • In the function bar, enter: FlowName.Run(name.Text, email.Text, title.Text). This allows us to trigger the Power Automate Flow and pass in the text input fields as parameters that reference the variables initialized in the Flow.

      WARNING: Power Apps expects a certain order for the parameters to be passed in and displays an example .Run() function call with the variable names as parameter placeholders. Make sure the order of the parameters match the expected order by Power Apps to prevent invalid argument errors.

      Note: Notice that by renaming the text input field elements in Step 23, you can easily reference them when passing them into the .Run() function as parameters. Power Apps has also color-coded each text input field to its corresponding parameter value.

      Power Automate: Connecting the Submit button to the DocuSign flow
  6. Select the Preview button in the upper-right hand corner to fill out the text input fields with recipient information and trigger the Flow by clicking the Submit button. Power Automate: Previewing the app Power Automate: Completed app and corresponding flow

And you’re done!

Although we only created one workflow in this example, additional flows can be made with the DocuSign trigger to listen for envelope status changes and take actions based on these changes. For example, when all recipients have signed an envelope and its status changes to “Complete,” the sender can be notified by a message in Microsoft Teams. 

While this blog post only scratched the surface of what can be done with DocuSign, Power Apps, and Power Automate, the possibilities are limitless! Check out more in our Power Automate Connector and User Guide.

Additional resources

Stella Kim
Author
Stella Kim
Product Manager Intern
Published
Related Topics