15 June 2016

Created a Validation Account Flow

Created a Flow that provides a couple of screens to the support reps.  Screens provide the necessary fields, and only the necessary fields to create an account, contact and case, all associated with each other.

Overview of the Flow Design



First the support rep must enter the account info.

Screen for the rep to fill out.  Only required fields available. 



Once the rep hits 'next' the account is created immediately.


Screen asking rep for contact and case info for the validated account.

Contact Creation

Case Creation





Here's more info from the Trailhead site re: flows.

Introduction to Visual Workflow, the Cloud Flow Designer and Flows


You may have heard several terms used interchangeably when referring to flows. Before we begin, let’s take a minute to define each of them and dispel some confusion.
  • Visual Workflow—the product that encompasses the process of designing, managing, and running flows. If you’re not sure about the difference between Visual Workflow and workflow rules, check out this help topic.
  • Cloud Flow Designer—a point-and-click tool that you can use to design flows.
  • Flow—an application that automates a process by collecting, updating, editing, and creating Salesforce data. Flows can execute logic, interact with the Salesforce database, call Apex classes, and guide users through screens for collecting and updating data. Most often, flows are built by using the Cloud Flow Designer.
In short, Visual Workflow is the product name, Cloud Flow Designer is the tool, and flows are the thing that you create...


Update 7/19/2016

When a created account doesn't pass the validation checks (duplicate account) then there's an error message after they hit the 'next' button.  This give no information as to why the account, case and contact we're created.

Adding an Error Message to the Flow

Because of the issue I mentioned above I've added an error message to the Flow. 

Here's the new layout. 



The first screen is the same as before.  Gather all of the info from the rep. 


The second screen is to assign all the entered fields from the rep as variables.  ie. Account Name = vAccountName


Then I'm looking up the account info based on the account name.  If the account's name = vAccountName (the name entered by the rep) then give me the AccountID


Next, if AccountID we searched for exists then we know this is going to trigger the duplicate error so let's let the rep change the name if they want. (typically they'd just stop here and go to the account in Salesforce instead).  


So, the next screen is simply a clone of the first with a notification that the account name was a duplicate name.  All the entry fields are suffixed with _0 now.

   

Since all the fields from the rep's entry are now suffixed with _0 we need to reassign them back to the variable they were before.  Using another Assignment allow us to reassign the populated fields back to the variables they were before. 


Checking again if the account is a duplicate. 

When there are no duplicates we're creating the records.  Records are getting created with the variables now though, not the entries from the rep directly like they were before. 



7/25/2016  Update

Added check that if country is US or Canada then the state/province needs to be populated.
And added check that all the other fields are populated too.



No comments:

Post a Comment