Copying a Wufoo attachment to Box
Use IBM® App Connect to create an event-driven flow that copies a Wufoo file attachment from a submitted form and adds it as a Box file.
Scenario
In this scenario, an Accounts department receives expense reports as Wufoo forms that employees complete and attach their expense reports to. When a form is submitted, App Connect copies the Wufoo attachment to Box so that you can collate and process the submitted expense reports monthly.
Find or create what you need
- Sign up for a free account or business account for Box.
- Sign up for a paid Wufoo account. You need a paid plan to use the File Upload capability that is used in this tutorial.
- To connect to your applications, get the following account details for your Box and Wufoo
accounts.
- The email address and password for your Box account.
- The API key and subdomain of your Wufoo account.
To find your Wufoo API key, go to the Wufoo Form Manager, open the More menu for any of your forms, and click API information. (The same 16-digit API key is used for all your forms.) You can copy and paste this API key into App Connect.
To find your Wufoo subdomain, click subdomain value is between https:// and .wufoo.com.. The
To connect App Connect to Box and Wufoo, complete the following steps in App Connect.- Open the App Connect catalog .
- If Not connected is shown for Box or Wufoo, expand that row, then click Connect to enter the account information.
- If prompted, allow IBM App Connect to access the application's account.
Tip: Alternatively, you can connect to an application when you add it to a flow. - Create a Wufoo form to which expense reports can be attached.
- Log in to your Wufoo account with the credentials that you used in App Connect.
- Create a Wufoo form from scratch with the form title Expense report submission and the description Fill me in to get your cash back.
- Click Add Field and on the Add a Field tab, click Section Break.
- On the Field Settings tab, set Field Label to Expense report for:, and set Instructions for User to Select the month and year.
- Click Add Field, then add a Single Line Text field. On the Field Settings tab for the new field, set Field Label to Month. Repeat this step to add a field with the label Year.
- On the Add a Field tab, click Section Break, then on the Field Settings tab for the new section, set Field Label to Details: and set Instructions for User to Complete your details.
- Click Add Field, then add a Name field and an Email field.
- To add a button for users to attach their expense report, click File Upload, then change the field label to Attach expense report.
- Click Save Form, then click Share this form. (You can also share the form later from the Wufoo Form Manager by clicking Start sharing.)
- From the Share page, make a note of the permanent link for your form, which
you can use to test the flow. Remain logged in to your Wufoo account. Tip: App Connect supports the use of embedded Wufoo forms. You can copy the embed code from the Share page and use it to display the form in your own web page. For example, to embed in a WordPress website, copy the code on the embed on WordPress tab, then paste it into a WordPress document. After you publish the WordPress document, you can send users the link to the published document that contains the embedded form.
- Create a text file with the name
expense_jdoe01.txt
that contains the following text:Jane Doe: My expense report for Sep 2023 1234
- In your Box instance, create a folder with the name ExpenseReports and assign editor permission.
Create your flow
- From the Designer home page ,
click Create an event-driven flow, or from the Designer
dashboard
, click .Tip: As you progress, App Connect saves your changes automatically. If you leave the flow editor at any stage, the flow is saved as a draft flow that you can complete at another time.
- Enter a name that identifies the purpose of your flow (for example, Add expense reports to Box).
- Add the Wufoo New form entry event to trigger your flow.
- Click Add trigger node
, expand Wufoo, then select New form
entry. Note: If you didn't connect App Connect to your Wufoo account in the catalog, you can connect to it when you add the event to your flow. If you don't see a list of applications under
Not connected
, click Show more applications and APIs. - Select the Wufoo form that you created earlier (
Expense Report Submission
). When someone completes and submits the expense report form, App Connect completes the action that you add to the flow in the next step.
- Click Add trigger node
, expand Wufoo, then select New form
entry.
- Add the Box Create file action to your flow.
- Click Add node , then click .
- In Folder, select the ExpenseReports folder that you created earlier.
- To help with collation in Box, prefix the file names of your submitted expense reports with the
month and year for which expenses are being claimed in Wufoo.
- Click in the File name field, click Insert a mapping , then select Month from the available values.
- Repeat this step to select the Year value.
- Type an underscore (_), click Insert a mapping
, then select File Name.Note: The list of available inputs is auto-populated with the fields that you added to your
Expense Report Submission
Wufoo form. For example, month, year, and email. A set of date and ID fields that are auto-generated in Wufoo are also included.
- In File content, type fi, then select File Content from the list (to indicate that the file contents of the Wufoo attachment must be copied to the Box file).
- In Type of file, select Text from the list.
- If you're on the VPC
hours plan, you can test your flow by starting it in App Connect Designer. If you're on the flow runs plan, you must deploy and activate your flow before you can test it.
- On the VPC hours plan, click Start flow on the toolbar, then click Dashboard to exit the flow. Your flow is displayed on your Dashboard as running, and is listening for your event, which is a submitted form in Wufoo.
- On the flow runs plan, go to the Manage tab , click Deploy, then select your flow. Click Next, then Deploy. A tile is created for your flow. To start it, open the tile menu, then click Activate.
Test your flow
To test the flow, you can assume the roles of an accounting team member and an employee who wants to submit an expense report.
- From a new browser tab or window, paste in the permanent link of the Wufoo form that you created earlier.
- Complete the form as follows:
- Month:
September
- Year:
2017
- Name:
Jane Doe
- Email:
jane_doe@example.com
- Attach expense report: Click Browse and select the expense_jdoe01.txt file that you created earlier.
- Month:
- Click Submit.
- Go back to the browser tab or window where you created the form.
- Go to the Form Manager and verify you can see that an entry was submitted.
- If necessary, log in to your Box account with the credentials that you used in App Connect. If you are already logged in, refresh your browser. (You might have to wait a few minutes for the file transfer to complete.)
- Open the ExpenseReports folder and verify that you can see a file with the
name
September2017_expense_jdoe01.txt
.
Try something a little different
In the preceding scenario, you created a flow that copies Wufoo attachments to a folder in your
Box account. In this scenario, you want to ensure that the files (typically attached as
expense.txt
) are uniquely renamed in the Box folder for each user submission per
month. To achieve this scenario, you can use App Connect's flow management and transformation
functions.
Complete the following steps to update and retest the flow.
- Create a text file named
expense.txt
, which can be attached to the Wufoo form. (You can make a copy of the previous file and rename it.) - Now, stop the flow so you can edit it.
- From the Dashboard, locate the flow. To locate a flow quickly, enter the first few characters of
the flow's name in the search box (in this case,
Add
). - Open the flow menu, and then click Stop. (Other options are available to view the flow while it's running, manage errors, export the flow for sharing, and delete the flow if no longer needed.
- From the Dashboard, locate the flow. To locate a flow quickly, enter the first few characters of
the flow's name in the search box (in this case,
- To edit the flow, click anywhere on the tile.
- From the flow editor, click the Box node.
Now, update the fields for the "Create file" action to specify a different naming convention for the file attachments.
- Update the File name field by applying transform
functions to define a file naming convention of
mmmyyyy_username_filename.txt
.- In the File name field, click Month and then
select Apply a function from the menu. Then select
$substring() from the Functions list. The
Month value is then shown as:
{{$substring(Month, start, length)}}
- Click start and then type 0 (that is, zero). Click length and then type 3. This function extracts the first three characters in a month's name.
- Click after the underscore (
_
). Then click Insert a reference , and then select Email from the list of available inputs. Then type another underscore. - Click Email and then select Apply a function from
the menu. Then select $substringBefore() from the
Functions list. The Email value is then shown as:
{{$substringBefore(Email, "chars")}}
- Click chars and then type @. This function
extracts the username from an email address username@domain, by using the
ampersand (@) as the delimiting character.
The completed entries for the "Create file" action are similar to the following example.
- In the File name field, click Month and then
select Apply a function from the menu. Then select
$substring() from the Functions list. The
Month value is then shown as:
- To restart the flow, open the options menu [⋮] in the banner and then click Start flow. Then click Dashboard to exit the flow. In the Dashboard, the flow is shown as running again.
- From a new browser tab or window, paste in the permanent link of the Wufoo form that you created
earlier, and then complete the form as follows:
- Month:
September
- Year:
2017
- Name:
Huck Finn
- Email:
huckfinn@example.com
- Attach expense report: Click Browse and select the
expense.txt
file that you created earlier.Click Submit.
- Month:
- If necessary, log in to your Box account with the credentials that you configured in App Connect. If you're already logged in, refresh your browser. (You might have to wait a few minutes for the file transfer to complete.)
- Open the ExpenseReports folder and verify that you can see a file with the
name
Sep2017_huckfinn_expense.txt
.