Updating or creating a contact in Salesforce and updating Asana when a Wufoo form is submitted

Learn how easy it is to use App Connect to connect Wufoo to Salesforce and Asana so that every time someone submits a completed change of address form in Wufoo, a Salesforce contact is automatically updated or created, and, according to the Salesforce action, a task is added to the appropriate project in Asana.

Note: This document assumes that you have signed up for free or trial accounts with Asana, Salesforce, and Wufoo, or that you have business accounts.

Scenario

For example, say that you're running a couple of special promotions for new and existing customers who've just moved house. You want to make sure that you keep your systems up to date with your customers' latest details, but you also want to strike while the iron's hot and complete your promotion activities while they still have that "new home" feeling. You want to offer your existing customers a slightly different deal to reward their loyalty, so it's important that you can identify them easily.

This tutorial shows how you can use conditional logic (in the shape of an "If" node) to take different actions depending on whether an existing Salesforce contact is updated, or a new one is created.

First, find or create everything you need:

  • An App Connect subscription.
  • The user names and passwords for your Asana and Salesforce accounts (if you haven't already connected App Connect to your accounts). You can connect to your accounts now on the Applications tab on the Catalog page, or you can connect as you add each application to your flow.
    Tip: If you want to create a free Salesforce account to test IBM App Connect, make sure that you create a Developer account rather than a Trial account.
  • The API key and subdomain for your Wufoo account.
    • To find your Wufoo API key, go to the Wufoo Form Manager, click More next to any form, then select API information. Copy the 16-digit API key and paste it into App Connect.
    • To find the subdomain for your Wufoo account, go to the Wufoo Account Manager by clicking Account, then selecting My Account. Copy the name between // and .wufoo.com and paste it into App Connect; so if your account has http://subdomainname.wufoo.com, just copy subdomainname to App Connect.
  • A test change of address form in Wufoo that you've shared. Make sure that the form has fields for the customer's name, address, and email address. (We added the "Fancy Pants" Name, Address, and Email fields.) You'll use these fields to update or create a contact in Salesforce.
  • At least one test contact in Salesforce (with a mailing address and an email address) that you can update during this tutorial.
  • Two projects in Asana: one called "New home promotion – existing customers", and one called "New home promotion – new customers".
  • If you want a bit more information before you start, you can read more about how to use App Connect with these apps on the following pages:

Next, create your flow:

Using the IBM App Connect Designer authoring experience, complete the following steps to create your flow from scratch.

  1. Log in to App Connect.
  2. From the Dashboard, click New > Event-driven flow.
  3. Enter a name that identifies the purpose of your flow, for example: Change of address promotion.
  4. Select Wufoo as your first application (source), then select New form entry as the Wufoo event that'll trigger the actions in Salesforce and Asana. "New form entry" means that one of your forms has been completed and submitted.

    (If you haven't already connected to your Wufoo account, click Connect and follow the instructions to allow App Connect to access your Wufoo account.)

  5. Select your change of address form.
  6. If the list of target applications isn't shown automatically, click the plus (+) and select Salesforce as your second application (target). Expand Contact, then select Update or create contact as the Salesforce action. This action will update the contact if it exists, or create it if it doesn't. This action is sometimes called an upsert action.

    (If you haven't already connected to your Salesforce account, click Connect to connect now.)

  7. As email addresses are unique, you can use the email address to identify your contact. So you'll create a filter to update the Salesforce contact whose email address is the same as the submitter of the Wufoo form. The filter is the field called Update where all of the following conditions are true.
    1. In the "where" condition, expand the first drop-down field and select the Salesforce Email field.
    2. Ensure that the operation field says equals.
    3. Click in the third field, and click the Insert a mapping icon Insert a mapping icon.
    4. Expand Wufoo / New form entry, then select the Email field.
      Figure 1. Selecting Email field from 'Wufoo / New form entry' to complete the action filter
      Screenshot showing a completed filter
  8. For each piece of data that you store in Salesforce for your contact, click the Insert a mapping icon , then select the appropriate Wufoo field that contains the data that you want to transfer to Salesforce, as shown in the following example:
  9. Figure 2. Salesforce / Update or create contact action with mappings from Wufoo / New form entry
    Salesforce / Update or create contact action with mappings from Wufoo / New form entry
  10. For our final action, we want to update Asana. But we want to take different actions depending on whether an existing contact has been updated in Salesforce, or a new contact has been added. We need to define some conditional logic to make that decision, so add an If (conditional) node to your flow. Click the plus (+), open the Toolbox tab, then select If (conditional).
  11. In the If node dialog box, configure the "if" branch.
    1. In the first field of the "if" statement, expand Salesforce / Update or create contact response, and select Status code.
      Figure 3. Mapping the Status code field from Salesforce / Update or create contact response
      Screenshot showing how to map a status code
    2. Ensure that the operation field says equals.
    3. If an existing record is updated, a response code of "200" is returned; if a new record is created, the response code is "201". So set the third field of the "if" branch to "200" so that the full condition reads Status code equals 200.
      Figure 4. The if condition 'Status code equals 200'
      Screenshot showing an if condition
  12. In the If node dialog box, click Add else if, and set that "if" condition in the same way, but this time to say Status code equals 201.
  13. Configure the else section of the If node dialog box.
    1. Select Exit flow at the end of this branch.
    2. Set the message type to Bad Request (400).
    3. For the message, type something like "No record was updated or created in Salesforce". You'll see this message on your flow tile on the Dashboard if it occurs.
  14. We'll now add some actions to the If node in our flow. Click the plus (+) on the "if" branch of the If node that says "Status code equals 200", and select the Asana "Create task" action.
    Figure 5. Selecting the (+) in the 'if' branch of the If node
    Screenshot showing where to add an action in an If node

    (If you haven't already connected to your Asana account, click Connect to connect now.)

  15. Select the Asana project called "New home promotion – existing customers" (because a response code of "200" means that an existing customer record was updated).
  16. In the Task name field, type "Send existing customer new home promotion campaign to", add a space, then click Insert a mapping Insert a mapping iconand select the Wufoo Email field.
  17. Repeat the last 3 steps to add another Asana "Create task" action to the "if" branch that says "Status code equals 201". But this time, select the "New home promotion – new customers" project, set the Task name to "Send new customer new home promotion campaign to", add a space, then map to the Wufoo Email field.
    Figure 6. The completed flow, showing details of the If condition
    The completed flow, showing details of the If condition
  18. Click Start flow on the toolbar, then click Dashboard to exit the flow. You can now see the flow on your Dashboard; as long as it says "Running", it's listening for your event – someone submitting a change of address form in Wufoo.

Finally, test your flow:

  1. Fill in your change of address form in Wufoo then submit the form. Try submitting one form that uses the email address of a contact that's already set up in Salesforce, and submit another form for a brand new contact.
  2. Log in to your Salesforce Developer Edition account and look at your list of contacts. You should see that your existing contact has been updated, and a new one has been created, showing the contact details that you sent in your Wufoo form.
  3. Log in to your Asana account and look at your projects. You should see a task in each project, prompting you to send the appropriate campaign to your new and existing customers.

Conclusion

Congratulations, you've created a flow that automatically updates Salesforce and Asana every time a new change of address form is received in Wufoo.