Bracket Labs delivers elegant, pain-free enterprise apps through the Salesforce AppExchange.  Our products help thousands of users plan & manage their work, share it with their teams, and increase revenue & decrease costs.  Learn more about TaskRay and Campaign Calendar.

Cirrus Insight Supports TaskRay Customers for Awesome Gmail Integration

This blog post could alternatively be titled "Sometimes Eric Misses Stuff That's Right in Front of his Face." Let me explain.

We've been big fans of Cirrus Insight ever since we met founder Ryan Huff at AppQuest in 2011. Both TaskRay and Cirrus Insight were semi-finalists in the competition, and both products have gone on to dominate their categories on the AppExchange. In case you haven't had a chance to check it out, Cirrus Insight is the leading app for integrating Gmail/Google Apps email with Salesforce (they've got 206 five star reviews as I write this).

Of course, since Bracket Labs uses Google Apps for our corporate email, we were also really excited to use Cirrus Insight. We've been customers since the beginning and now find it indispensable to our daily work.

I've recently been helping the CI team beta test a new version of their app that's filled with sweet new features. As I was playing with the new features, it occurred to me that Cirrus Insight could easily be made to attach emails and email attachments to custom objects, similar to what I currently use it for with Leads and Contacts. This would allow a TaskRay customer to attach an email to a Task or Project directly from their Gmail inbox.  I got really excited as I thought about this and I quickly jotted a feature request in the beta testing feedback forum. Ryan quickly replied,

"We already do this Eric, am I missing something?"

Sure enough, CI already has the ability to attach emails and attachments to custom objects, meaning that they already supported TaskRay customers. I completely missed the fact that I could have been attaching emails and files to TaskRay Tasks and Projects in Salesforce this whole time!

My "DUH!" moment has done nothing to dampen my excitement. TaskRay's native Force.com architecture means that Ryan and the CI team are able to support TaskRay without having to do anything special in their code. They support custom objects, we use custom objects, it's done! This is one of those moments where the true power of the enterprise app concept becomes apparent, customers can plug multiple connected apps into a platform and they all just start working together. If you've ever spent time and big $ on middleware solutions to get your systems talking to each other, you have a special appreciation for how cool this is.

To make it even cooler, both Cirrus Insight and TaskRay are available as fully-functional free trials. This means you can install both apps and take them for a spin in your own Salesforce instance. Try them out and join the connected app revolution today!

Task Dependencies

What do these three scenarios have in common?

  • The Sales Fulfillment team requires a signed contract prior to shipping the product.
  • The Accounting team requires reconciled bank statements before closing the books.
  • The Marketing team must create content prior to sending an email campaign.

Each of these distinct departmental business processes require the completion of one task before another can begin, otherwise known as task dependencies. As you can imagine, this is a feature question we often hear for TaskRay. The great news is with the power and flexibility of the Salesforce platform, dependent tasks are natively supported.

Here's a walkthrough to show just how easy it is to set up dependent tasks in your TaskRay implementation (this assumes you have admin permissions in your Salesforce instance - if not, show this blog post to your admin).

Step 1: Add the Dependency look-up relationship

  1. Navigate to Your Name | Setup | Create | Objects | TaskRay Tasks.
  2. Scroll to the Custom Fields & Relationships section and click New.
  3. Select Lookup Relationship and click Next.
  4. Select TaskRay Task for Related To field and click Next.
  5. Change Field Label, Field Name & Child Relationship Name to Dependency and click Next.
  6. Manage profile visibility and click Next.
  7. Click Next to add to Page Layout.
  8. Change Related List Label to Dependent Tasks and click Save.

Step 2: Add the Dependency field to the TaskRay Task Field Set

  1. Navigate to Your Name | Setup | Create | Objects | TaskRay Tasks.
  2. Scroll to Field Sets section and click Edit next to TaskRay Task Field Set.
  3. Drag Dependency field into Field Set.
  4. Click Save.

Step 3: Add a Validation Rule to catch Dependent Tasks

  1. Navigate to Your Name | Setup | Create | Objects | TaskRay Tasks.
  2. Scroll to Validation Rules section and click New.
  3. Name the rule Dependent_Tasks and set it to Active.
  4. Enter the sample error condition formula as outlined in the snipped below.
  5. Enter this sample Error MessageThis task cannot be started until the dependent task is complete.
  6. Click Save.

Error Condition Formula

AND( 
OR (ISPICKVAL(TASKRAY__List__c,"Started"),ISPICKVAL(TASKRAY__List__c,"Finished")),
NOT (ISBLANK( Dependency__c )),
NOT(ISPICKVAL(Dependency__r.TASKRAY__List__c, "Finished"))
)

Step 4: Watch it work

Salesforce Visual Flow and TaskRay Walkthrough - Part 3 - Advanced Topics

This is Part 3 of a series on using Salesforce Visual Flow to automate the creation of TaskRay projects and tasks. Part 1 and Part 2 were previously published.

So You Think You Can Flow?

In Part 2 we covered how to build a basic flow that automates the creation of a TaskRay project from the Account object. This project is then populated with a number of TaskRay tasks, and all of the records we created were correctly labeled and related to the Account.  With the basics out of the way, now's the time to start dreaming big. This section is all about reveling in the complexity (and advanced functionality) of the visual flow we demo'd in Part 1.

The biggest request that I get is for relative dates - to set a task to start a week after the button is pushed or two days after the project starts, for example. It sounds easy, but at first the only answer I could work out involved adding new fields and supplementing my visual flow with a workflow rule. You see, one of the odd limitations of flows is that you can't create formulas using dates or set values as MM/DD/YY + number. The answer, as it turns out, is in using the Assignment element. We start by creating a date variable we can manipulate during our flow and setting its default as the current date.

Creating a date variable

Creating a date variable

Now any time we need to specify a date value relative to another date, we just use our new favorite variable. My flow actually starts with an Assignment element, because I want to specify a Project End Date two weeks after the project is created.

Creating a Visual Flow Assignment element

Creating a Visual Flow Assignment element

Three things to keep in mind:

  1. The "Value" you provide will adjust days, rather than hours, months, or years.
  2. I set a default value for varDate when I created the variable so I'm adding two weeks to the CurrentDate when the flow is run.
  3. You can pass in other dates - an Opportunity Close Date, for example - to serve as your starting point instead.

As you need to change the variable throughout the flow, create new Assignment elements. Just keep in mind that you're always adjusting the most recent value for the variable, not the default or starting value. I grouped my tasks by Deadline and adjusted the variable's value to reflect the number of days after the Project Start Date each task should be due.

Multiple Assignment elements

Multiple Assignment elements

Another common request is choose among several template options based on criteria in a related record. For example, say you want to create a project with follow-up tasks for your sales reps every time an Opportunity is closed. The individual tasks, however, need to vary first based on whether the Opp is Closed Won or Close Lost and secondly on the value in a custom Closed Lost Reason field you've created. In this case we use a Decision element:

Creating a Decision element

Creating a Decision element

After you give the element a name, you create "Outcome" values. This is a little bit deceiving, because these are not Outcomes in the sense of what happens after the decision. Think of it as asking the flow a question, like "What is the Opportunity Stage?" Then you tell it what the possible answers (Outcomes) might be. In my case, I only care about three possible answers: Closed Won, Closed Lost, and everything else. Once you've created your Decision, you continue by connecting this element to the rest of your flow in the same way we connected all the other pieces. The only difference is that you can connect a Decision to multiple actions, one for each possible outcome. Once you've created the connection, a lightbox will pop up asking you which Outcome to associate with that action.

You can use these to decide between entirely different project templates or you can choose between a certain task or group of tasks. Or both! You can certainly use multiple Decisions in a single flow, but if you do, just remember to take the time to think things through first. It's always better to have only as much complexity as you need and as much simplicity as you can manage!

We're getting close to the end, but I want to close this post with four last notes:

  1. Screen elements: You probably noticed in the last video that my last Outcome directs the user to something called "Screen." I used it to display a message to my users when they create a project before the Opportunity is closed. It's how I addressed the question "What if the Opp Stage isn't Closed Lost OR Closed Won?" but you can use it for a lot of purposes. The Screen element lets you collect additional information from a user as well as display it. If you want to use a template flow but need the user to answer a few questions first, consider starting with a Screen element. You can ask your questions, assign the answers to a few variables, then let the flow do its magic! If you collaborate with a developer, you can incorporate Visualforce pages in a Screen element for an even better user experience.
  2. Record Lookup/Update: Say you want to use the information you passed in from an account to look up a specific Opportunity or you want to use some of that useful information you gathered with your Screen element to look up a specific Contact. No problem! Add a Record Lookup element to find additional information and pull it into your flow. Maybe instead you have a custom Related Project field on the Account object, and you want to make sure the newly created project ID is added to the related account record automatically. No worries! Just add a Record Update element to make sure all your records are connected and nothing gets lost.
  3. Connections: Although Decision elements are the only action that can branch outward to multiple actions, all of the elements can receive multiple in-coming connections. For example, say you need to adjust a value differently based on the Outcome of a Decision you've created. Don't fret! You can connect both Assignment elements back to a single Record Create action.
  4. Fault Handling: The more your flow relies on user input or values that are not systematically required, the more you need to pay attention to error messages and fault handling in visual flows. I haven't used them much yet, to be honest. I have, however, received my fair share of "Unhandled process fault" emails from FlowApplication while in the process of building and testing my flows. When you get these messages, focus on the middle two sections. The second line tells you what happened and which fields were involved, and the third line tells you which element in your flow caused the problem. What do you do when this happens? Start by double-checking the data. Did you update or mistype the variable name? Does the flow variable come before the merge field in your URL? Did you correctly configure the variable that's receiving the information? Did you match the appropriate value to the right field when creating your record? If the error occurs after the flow's successful debut, double check that none of your object or field names have been changed.

I hope you've found this walkthrough a helpful starting point as you venture into the wonderful world of Salesforce flows. I've included some links to additional resources to round out your education below.

If you have any questions or need additional help - or if you just want more information about TaskRay, click the Feedback link in the upper right of TaskRay to send us a note or drop us a line on Twitter using @bracketlabs.

Salesforce Visual Flow and TaskRay Walkthrough - Part 2 - Build the Flow

This is Part 2 of a series on creating Visual Flow in Salesforce. Part 1 is here

Gather Your Ingredients

Now that we've thought through what we want to happen and what information we're using, let's get started. No, I mean, literally. Go to Setup / Create / Workflow & Approvals / Flows and click the New Flow button. Great! Just a friendly word of warning: though it's been working in Chrome lately, sometimes I've had to change browsers altogether and run the Flow Designer in Firefox.

Once the designer is loaded, look at the sidebar on the left. You'll see three tabs: Palette lists all the action elements for a flow, Resources lists all the data elements, and Explorer shows you the parts you've already created. I recommend starting with the Resources and getting your variables created first, just like gathering all your ingredients before you start cooking. You don't have to do it, but it does make the process a little less hectic.

In the Resources section, you'll see a Create New list. Double click on Variable and fill out the lightbox. We're only going to create four variables, one for each of the fields populated by the system. Salesforce recommends using a consistent naming convention to help you keep it all straight, and trust me, it helps a lot! I like using the prefix "var" and copying the field name, so my variables look like this:

varAccountName
varAccountID
varAccountOwnerID
varProjectID

Remember, we're not providing actual values right now (you can think of this part as creating a custom field for your flow). Most of the information is pretty straight-forward, but a couple of the options are a little confusing:

  • The one place I've been tripped up with Data Type is when I'm creating a variable for some sort of record ID. Remember that Salesforce-generated IDs use a combination of letters and numbers which makes them text strings, not numbers, in flow variables.
  • Input/Output Type tells the flow whether it's going to receive this information externally, pass the information back to the user, or both. If you're not sure, err on the side of "Input and Output."
  • The Default Value field at the bottom lets you specify, well, a default value if none is provided, but I use it only rarely.
Default Value field

Default Value field

Creating a Masterpiece

Now we head to our Palette tab, where things start to get more exciting. My flow is basically a series of Record Create actions, because I want to create a new TaskRay project with a set series of tasks. I need the flow to create my Project first, because I'm going to need to associate the new project's ID with all of the tasks I create next. Start by dragging the Record Create element onto your palette (anywhere in the top left will do), then fill out the lightbox that appears:

  1. I use a similar naming convention whenever I create my action elements for the flow, so my record name will be "createProject." I use prefixes that describe the element, just to keep things easy to follow. The system will automatically create the "unique name" for you.
  2. The Assignments section is where the real magic happens. First, I tell it that I want to create a new record for the custom object TASKRAY__Project__c, then I get to define the values for any of the fields on the record.
  3. Let's start with the basics: Name and Owner. Start typing Name in the first box, and select it when it appears in the drop-down list. Click the Add Row link below, and do the same for Owner.
  4. Now we're going to fill in the boxes to the right of each field with the desired values. I want my project name to display as a concatenation of Account Name + Messages Checklist, so I select varAccountName from the list then type Messages Checklist (no plus signs or quotes necessary!). I also want my Project Owner to be the same as the Account Owner, so I select varAccountOwnerID in the next box. You could, however, pass in the CurrentUserID instead, or even assign the task to a specific user every time.
  5. The last thing we have to do is store the Project ID created for this record, so we assign the value to our variable varProjectID.
Visual Flow Record Create form

Visual Flow Record Create form

Now we're going to do the same thing, but for a task. Again, start by dragging the Record Create element onto the palette. It doesn't really matter where you put it, but as your flow gets bigger, it helps to have some sort of organization to keep all the pieces straight. I'll show you what it looks like:

Note that I didn't assign the record ID to a variable for the task record, because I won't need to use that data later in the flow. Now, take this basic idea and repeat it for each task you want to create. You can also fancy it up a little and specify more fields. I'll show you what the same element might look like with additional fields listed:

Visual Flow Record Create with many fields

Visual Flow Record Create with many fields

The Name, OwnerID, and Project fields are all the same, but I've added some extras:

  • The Task Deadline field is a favorite, but relative dates in visual flows require some fancy footwork. We'll cover that in Part 3 under advanced topics.
  • Description can be a convenient field to use on a Task if it's always going to be the same. You could also take an Account Notes field, for example, and pass that information into the Description value (especially helpful for the Project Description!).
  • The List field is used by TaskRay to assign a task to one of the "Status Lists." I often use this for the first couple tasks, so that I can put them straight into the Prioritized column. If you don't assign a list, the tasks will automatically be put in Holding.
  • The Sort Order field is used to assign the order of tasks in a list, so if the order of operations is important to your project, you might consider using this field. Just remember that that if you're using the List field too, you order the tasks within each list individually.
  • Related Account is a custom field I added to the the Project and Project Task objects so that I can associate my projects and tasks with a specific account and move between them easily. I'll use the Account ID passed in by the custom button as the value for this field.

I know creating all your tasks with eight or more fields is a less than exciting prospect, so here's some good news: the Flow Designer lets you clone elements. Once you've created one Record Create element to your satisfaction, select it (so that it's outlined in green) then click the Copy icon in the toolbar. Use the neighboring Paste icon to give you a head start on all the rest of the tasks in your template! If you're creating some thing more complex, you can hold down the Ctrl (Windows) or Cmd (Mac) key to select multiple elements at once, making it quicker and easier to copy and paste or move around entire portions of your flow simultaneously.

Once you've built out your basic template you have to do a couple more things:

  1. Tell the flow which element is your starting point: When you hover over your first action element, you'll see three icons in the top right corner. The pencil opens the Edit lightbox, the trashcan deletes the element, and the green circle identifies the element as the first action in your flow. Click the green icon; it should show in the top right even when you move your mouse away from element.
  2. Connect your elements in the order you want the flow to proceed: Click and hold on the small triangle at the base of your first element and drag your mouse over to the next action, then release. A gray arrow should appear, connecting the two elements, and indicating the direction of the flow. Continue until all your actions are connected.
  3. Save your visual flow, then close the Flow Designer. You'll return to the page listing your flow's details, including the unique URL we'll need to set up our custom button. Before we go any farther, though, scroll down to the Flow Versions section of the page, and click the Activate link to the left of your flow.

It's worth noting that once you've activated a flow, you'll have to save any changes as a new version. The Save As lightbox provides a description field that lets you note the changes specific to each version, a feature I've found handy in tracking my work. Whenever you're ready to run your new version, don't forget to deactivate the previous version and activate the new one (only one version of any given flow can be active at a time).

Make It Work!

Most of the visual flows I've written to interact with TaskRay are triggered using a button on an object's record detail page, usually on Accounts or Campaigns. In case you've never created a custom button on a standard object, here's the super-quick summary! Find the object under Setup / Customize, then look for the Buttons and Links option. Click the New button next to Custom Buttons and Link. The page should look something like this:

Creating a cCustom button on an object

Creating a cCustom button on an object

The Label is the text that will show on the button itself, so try to think of something both descriptive and concise. You can see the selections I have made for Display Type, Behavior, and Content Source, but feel free to experiment with different settings.

I'll provide a quick overview of the anatomy of a URL, since it's just a little different from the way parameter passing tends to look in Salesforce:

  • /flow/Project_Template? - Remember when I pointed out the unique URL provided on the flow's detail page? Well, that's where this first part comes from. You can literally just copy and paste it! The question mark that comes next just indicates that the parameter passing is about to begin.
  • varAccountID={!Account.Id}&varAccountName={!Account.Name}&varAccountOwner={!Account.OwnerId} - This middle portion is what we've been calling "parameter passing," and it just means that we're taking information from the record where the button is located and passing that into the location indicated in the URL. For us, that's our flow. Remember that we're only passing over the information we decided on earlier, the specific data we need for our flow. Each parameter is separated by an ampersand and is written as [flow variable name] [equal sign] [merge field], like varAccountID={!Account.Id}. The good news is that Salesforce will create the merge field for you, so all you have to remember are the names of your variables.
  • &retURL=https://taskray.na9.visual.force.com/apex/trmyboard - Because my flow works entirely in the background, I want the URL to direct my users to TaskRay where they can see their newly created projects - and get to work immediately (evil chuckle)! You can leave off this section (and the preceding ampersand), or change the return URL value to something else entirely.

Once you've saved your new button, add it to the relevant page layouts and test it out.

Congratulations, you've just built your first visual flow and created a button to trigger it. You can use these same techniques to build this automation functionality across any number of objects. And if you're anything like me, you'll quickly want to start making them more sophisticated. In Part 3 we'll cover some advanced topics for making your Visual Flows more, well, advanced.