Build a One-Screen Mobile App for Easy Record Creation.

Build a One-Screen Mobile App for Easy Record Creation | Automate This!

By

Welcome to another “Automate This!” In this live-streamed video series, we cover all things automation, from use cases and best practices to showcasing solutions built by Awesome Admin Trailblazers like you. With automation, you can remove manual tasks, drive efficiency, and eliminate friction and redundancy. In this episode, see how Dirk Keaton created a one-screen, mobile-friendly flow that his peers at So Others Might Eat use to record case interactions with dining room clients.


Use case: Specialists need to track case notes easily on mobile devices

I’m the Salesforce Admin for So Others Might Eat (SOME). Founded in 1970, SOME provides food, medical and dental care, substance abuse treatment, mental health care, education, and affordable housing to approximately 5,500 residents of the nation’s capital each year. More than 150 users across SOME’s portfolio of services use Salesforce to record client case notes and track outcomes and service deliveries. This allows our staff to collaborate across programs and get a 360-degree view of client needs. Our dining room serves at least 250 unique clients each day.

For many, the dining room is the first step that clients take before accessing other SOME services. Others may attend our dining room for years before walking across the street to receive healthcare, counseling, or other assistance. To ensure that clients take the “next step,” SOME hired a Peer Support Specialist who engages with dining room clients, provides basic case management, and refers clients to services.

Our integration team wanted to make sure that the Peer Support Specialist’s case notes were recorded in Salesforce. I worked with them to identify the following key requirements for a Lightning app.

The Peer Support Specialist should be able to:

  • Access the app through a tablet so that they can record case notes while “in the field”
  • Create case notes for anonymous clients and for clients with incomplete data so that we can track case management while respecting client privacy
  • Access all of the app features on one screen so that data entry is easy and intuitive

Since launch, our Peer Support Specialist has used this app to track interactions with more than 230 unique individuals. We estimate that this is about one-third of all the clients who visit our dining room.

Solution: A single mobile-friendly screen to capture notes

Once the Peer Support Specialist opens the app, they have the option to either look up the client or add a new client (either anonymous or not). If they toggle Add Client to Active, the Contact fields will appear.

A Salesforce mobile app screen including Find Client Name (Lookup), Add Client (Toggle), Add Anonymous (Toggle), Salutation, First Name, Middle Name, Last Name, and Suffix fields.

If they toggle Add Anonymous to Active, the Contact fields won’t appear, but a new record will be created. Regardless of their choice, they will be able to scroll down and create a client case note.

Mobile app screen with display text Enter Client Note Below. Fields include Date of Service, Service Type, Client Note, Identified Needs, Program Referred To, and Warm Handover checkbox.

As you can see, the client and their case note are immediately added to our system.

Salesforce record page displaying the fields entered in the previous screens, including a Program Engagement lookup field.

Make a one-page app

First, I created a custom object named Peer Support Case Note with the fields shown in the schema diagram below.

Schema Builder window for object named Peer Support Case Note. Fields include Client Needs (Picklist, Multi-Select), Client note (Long Text Area), Date of Service (Date), Meeting Type (Picklist), Program Engagement (Lookup on Program Engagement), Program Referred To (Picklist), and Warm Handover (Checkbox).

You may have noticed that the schema diagram contains a Program Engagement (PE) lookup field. Program Engagement is a standard field included in Salesforce’s Program Management Module (PMM). This free, open-source tool lets direct service nonprofits track the tangible (for example, meal distribution) and intangible (for example, case management) service that they provide and associate them with individual clients and programs (for example, Peer Support). This gives us a 360-degree view of each client’s service participation and the overall impact of our programs.

This is the screen flow I created. While it may seem complex, it accomplishes four things behind the scenes.

1. Find or create a client contact record.
2. Find the Peer Support program.
3. Find or create a Peer Support program engagement.
4. Create a Peer Support case note associated with the client program engagement.

Flow canvas showing the full Peer Support Worker App.

I began by creating a screen flow named Peer Support Worker Notes App. I created a screen with a lookup field with the Object API Name Contact and the Field API Name MasterRecordId.

Lookup field for Contact; the label is 'Find Client Name'.

I also added two toggles named Add Client and Add Anonymous as shown in an image in the Solution: A single mobile-friendly screen to capture notes section above. I designed the flow so that if the Peer Support Specialist toggles Add Client on, they will be prompted to give demographic information about the client. If they toggle Add Anonymous on, they will not be prompted to add demographic information.

Next, I needed to bring the Contact fields into the screen using Dynamic Forms for Flow, rather than recreating them within the screen flow. This is done by creating a contact record variable named NewContact.

Variable with Data Type 'Record' and Object 'Contact' named 'NewContact.'

Once this was complete, I dragged and dropped the Contact fields onto the screen.

NewContact can now be be seen under the record variable lookup; Contact fields are visible.

Whenever staff enters information in these fields, the NewContact variable will immediately be updated.

I then used this method to create a Peer Support Case Note record variable named ClientCaseNote, and added fields from the variable to the screen (as shown in the Solution: A single mobile-friendly screen to capture notes section above.)

To make sure everything could fit on one page, I used conditional visibility. This feature lets you hide or display fields based on whether a formula evaluates to true. In my case, I clicked Set Field Visibility for each Contact field and chose to display the field for When All Conditions Are Met.

My formula was: {!AddClient.Value} Equals {$GlobalConstant.True}. AddClient is the API Name of the toggle you see below. What this means is that if the toggle is switched on (its value equals true), the Full Name fields will appear. Since we won’t have demographic information for anonymous clients, we don’t need to reference Add Anonymous in our visibility rules.

Set field visibility panel for the Contact Field 'Full Name'.

Debug/test your flow to ensure the Full Name field appears when the Add Client toggle is selected. Then, repeat these steps for other fields.

Once you’ve added the fields to the screen, you’re ready for the next step.

Deal with incomplete data

SOME does not require dining room clients to share their personal information to receive services. As a result, some key information (like birthdate, a mandatory field in our organization) may be blank.

The first Decision checks to see whether AddClient is toggled and whether birthdate is blank.

Portion of the screen flow showing a Screen element named ‘Peer Support Worker Notes App’ leads to a Decision named ‘Add Client.’ A path called ‘Toggle Selected and Birthday Blank’ leads to an Assignment element named ‘Set default Birthday’. This leads to the ‘NameBlank’ Decision element. A path named Toggle Selected and Birthday Not Blank leads to the same Decision element. The default path from 'Add Client' leads offscreen.

If the Specialist did not turn either toggles on, the default path will execute. If AddClient is toggled and a birthdate was entered, Toggle Selected and Birthday Not Blank will be true.

Decision element showing an Outcome named ‘Toggle Selected and Birthday Not Blank.’ The conditions are AddClient>Value Equals True and NewContact>Birthdate Is Null False.

If either AddClient or NewClient is toggled and a birthdate wasn’t entered, Toggle Selected and Birthday Blank will be true.

Decision element showing an outcome named ‘Toggle Selected and Birthday Blank’. The conditions are AddClient>Value Equals True and NewContact>Birthdate Is Null True or Anonymous>Value Equals True.

The ‘Set default birthday’ Assignment element assigns 01/01/1970 (the date I use for anonymous clients throughout the system) as the client’s birthday.

Assignment element named 'Set default birthday' where NewContact>Birthday is set to 1/1/1970.

Either way, the flow will pass to the next Decision element which checks to see if the name is blank.

‘Nameblank’ Decision element; ‘Name is Blank’ outcome leads to the ‘Assign Anonymous Name’ Assignment element and ‘Create record from new contact’ Create Records element. The default outcome also leads to this element.

If the following condition is satisfied, it will pass the flow to the Assign Anonymous Name step.

Decision element showing the ‘Name is Blank’ outcome is true if the NewContact>LastName Is Null is equal to True.

Assignment element where NewContact>LastName is set to the value from the ‘AnonymousId’ formula resource.

AnonymousID is a text formula resource with the value:

"Anonymous Peer Support Client " + TEXT({!$Flow.CurrentDateTime})

By assigning each anonymous client a unique name, we avoid duplicate rules and make it easier for the Peer Support Specialist to differentiate between them.

Once that’s done, the flow creates a new contact record using values from the NewContact record variable.

Create Records element where a contact record is created using all the values from the variable 'NewContact'.

How to avoid duplicates: Part 1

Shortly after launching the app, we noticed that the Peer Support Specialist often attempted to create records for clients who were already enrolled in other SOME programs. This created errors that shut down the flow. I solved the problem by creating a fault path. Once a duplicate is created, it proceeds to the Get Records element called Get Client Id.

Create Records element with a fault path that goes to the 'Get Client ID' Get Records element.

The Get Records element searches for the existing contact record that triggered the error.

Contact Get Records element searching for a contact with the first name equals ‘ModifiedFirstName’ formula resource, last name equals a ‘ModifiedLastName’ formula resource, and the birthdate equals the birthdate associated to the new contact variable.

You may have noticed that the values for FirstName and LastName are ModifiedFirstName and ModifiedLastNameformula resources. Many phones and tablets add a space after each word. The Get Records element is case sensitive. It won’t find a client with first name “Dirk” and last name “Keaton” if it searches for a contact named “Dirk” and “Keaton”. I solved this problem with the following formula which uses the substitute function to replace spaces (or " ") in the first name with blanks (or "").

SUBSTITUTE({!NewContact.FirstName}," ",""}
Formula resource with a Text data type and SUBSTITUTE({!NewContact.FirstName}," ",""}.

Reuse variables

It’s important for admins to use as few variables as possible in flows with multiple Decision elements. I needed to reference contact Id in Get Records and Assignment elements throughout the flow. By assigning all contacts the same variable, I didn’t have to worry about which path the flow traveled.

On the Get Records element called Get Client Id, shown below, I assigned the value of Id to a text variable named ContactIdVariable.
Get Records element showing the field value for Id is stored in the ‘ContactIdVariable’ text variable.

When I created the lookup element, that I walked through earlier in the Make a one-page app section above, on the Peer Support Worker Notes App screen, I also assigned the contact ID to ContactIdVariable. To do this, select Advanced on the lookup element, and select Manually assign variables. Then, assign Record ID to {!ContactIdVariable} as shown below.

Screen lookup component; Under the Advanced heading, 'Manually assign variables' has been selected. The Record Id is stored in a text variable named {!ContactIdVariable}.

After a new contact is created (using the Create Records element called Create record from new Contact), the flow moves on to the Assignment element called ContactId Assignment.

'ContactId Assignment' Assignment element leads to the ‘Get Program for Program Enrollment’ Get Records element. Two other paths also lead to this element.

The Assignment element assigns the value of {!NewContact.Id} to ContactIdVariable and assigns Yes to a CreatedFlag text variable. (I will discuss the flag in the next section.)

'ContactId Assignment' Assignment element where the variable 'ContactIdVariable' is assigned the value NewContact>ContactId and the 'CreatedFlag' text variable is assigned the value Yes.

How to avoid duplicates: Part 2

Regardless of which “path” the contact takes, all paths meet at the Get Records element called Get Program for Program Engagement. Programs are a standard PMM object that help service nonprofits organize their service deliveries into service lines (just like marketers use campaigns to organize their communications). Client contact records are associated with programs through the Program Engagement object.

In this case, I use the Get Records element called Get Program for Program Engagement to look for a program called Peer Support.

Get Records element for the Program object where the Name equals Peer Support.

The flow then moves to the Decision element called Test to see if Created is Flagged.

‘Test to see if Created is Flagged’ Decision element has two outcomes. If the ‘Record Created’ outcome is executed, it goes to a Create Records element named 'Create Program Engagement'. If the Default Outcome executes, it goes to a Get Records element named 'Get Program Engagement.' It then goes to a Decision named 'Is PE Null'. If the Default Outcome executes, it goes to 'Create Program Engagement'.

To avoid duplicates, I need to make sure that the client doesn’t already have a Peer Support program engagement. While one could make every flow pass through the Get Records element called Get Program Engagement, Get Records (and other pink elements) slow down your flow. By testing to see if CreatedFlag equals Yes, I avoid an unnecessary Get Records step.

‘Test to see if Created is Flagged’ Decision element. The Record Created Outcome executes if the CreatedFlag text variable equals Yes.

If the default outcome executes, the flow moves to the Get Program Engagement element which uses the ContactIdVariable and Program_from_Get_Program_for_PE.Id to find any existing program engagements for a client.

Get Records element for the Program Engagement object. The field pmdm_Contact__c Equals ‘ContactIdVariable‘ and pmdm_Program__c Equals ’Program_from_Get_Program_for_PE.Id’.

I then select Choose fields and assign variables (advanced) and assign the ID to a text variable named PEID.

‘Get Program Engagement’ Get Records element. If a record is found, the Id is set to the text variable ‘PEID‘.

The Decision element called Is PE Null determines if the client has a program engagement. If they do, then the value of PEID would not be null (meaning it has no value).

If the PEID variable is, in fact, null, the flow moves to the Create Records element called Create Program Engagement. Note that I select Manually Assign Variables and store the value of the new record in PEID. This, again, allows us to use a single Assignment element to populate the fields for the Peer Support Case Note.

Program Engagement Create Records element. ‘pmdm_Contact__c’ is assigned the value’ ContactIdVariable,‘ pmdm_Program__c is assigned the value ’Program from Get_Program_For_PE.Record Id, and ’pmdm_Contact__c’ is assigned the value ‘Current Date’. The program engagement ID is stored in the text variable ‘PEID‘.

Create the case note

After creating or finding the contact, program, and program engagement records, we’re ready to create the case note.

Two paths lead to the 'Assign Service Case Note Fields' Assignment element. This leads to the 'Create Case Note' Create Records element.

Since peer support case notes are child records of the program engagement record, this Assignment element assigns the value of PEID to {!PeerSupportCaseNote.Program_Engagement__c}.

In this Assignment element, {!PeerSupportCaseNote.Program_Engagement__c} is assigned the value ‘PEID‘.

Finally, the Create Records element called Create Case Note creates the case note.

The Edit Create Records page for the Create Case Note element.

Final thoughts

This is one of half-a-dozen one-screen flows that I used to help move programs that were used to track activities on paper and in Excel spreadsheets to Salesforce. Through behind-the-scenes Get and Create Records elements, the frontline staff can quickly create records that align with our data model without being experts in elements of the data model that they won’t interact with on a daily basis. Most importantly, this element, like the others, was developed with the feedback of the Peer Support Specialist and their supervisor. Ultimately, the greatest test of success is that we created a tool that they feel comfortable using every day.

Resources

Want to see more good stuff? Subscribe to our channel!

SUBSCRIBE TODAY
Boost your study routine with flows and email-to-text gateways

Boost Your Salesforce Certification Study Routine with Flows & Email-to-Text Gateways | Automate This!

Welcome to another “Automate This!” In this live-streamed video series, we cover all things automation, from use cases and best practices to showcasing solutions built by Awesome Admin Trailblazers like you. With automation, you can remove manual tasks, drive efficiency, and eliminate friction and redundancy. In this episode, let’s see how Bradley Condon built the […]

READ MORE
Leverage flows to process inbound emails with documents

Leverage Flows To Process Inbound Emails With Documents | Automate This!

Welcome to another “Automate This!” In this live-streamed video series, we cover all things automation, from use cases and best practices to showcasing solutions built by Awesome Admin Trailblazers like you. With automation, you can remove manual tasks, drive efficiency, and eliminate friction and redundancy. In this episode, let’s see how Ohad Idan vanquishes shared […]

READ MORE
Improve sales funnel velocity with Flow

Improve Sales Funnel Velocity Using Flow | Automate This!

Welcome to another “Automate This!” In this live-streamed video series, we cover all things automation, from use cases and best practices to showcasing solutions built by Awesome Admin Trailblazers like you. With automation, you can remove manual tasks, drive efficiency, and eliminate friction and redundancy. In this episode, learn how Becka Dente leverages a simple […]

READ MORE