How the Admin Relations Team Uses Salesforce to Manage Content

How the Admin Relations Team Uses Salesforce to Manage Content Creation

By

As an admin, it’s important to ensure data quality in your org. This can be a bit challenging when you have records with a loosely coupled relationship with one another (that is, a lookup relationship), but you need to ensure that at least one of these records exists. You can’t use your handy admin tools like validation rules or required fields to solve this. So, what do you do?

I have to admit, since joining Salesforce, I haven’t been in Salesforce every day getting my hands dirty with configuration, (which I LOVE BTW). When the opportunity arose to improve the Salesforce org the Admin Relations team uses to manage our content, I jumped at the challenge!

Don’t be passive. Tell them what’s wrong.

We use Salesforce to manage the content for our website, admin.salesforce.com. And we use custom objects to manage our content: Content, Contributor, and Content Topics. Contributor and content topics records are loosely related to a content record via a lookup to the content record. Each content record should have at least one associated contributor record and at least one content topic. A contributor record specifies people who have a role in the content record, such as author, reviewer, host, speaker, etc. A content topic is a way to categorize the content record, such as process automation, Salesforce release, change management, etc. However, we’ve found that not everyone creates a contributor or content topic record for each contact record, hence the data problem. We created exception reports and dashboards, but that relies on the user to review them on a periodic basis. Why not tell them right on the record?

Here’s what I envisioned as a solution: Show them a fun message letting them know they’re missing an associated contributor or content topic record. Once the user adds at least one contributor or content topic record, we’ll remove the message.

The display of the missing contributor and content topic messages after a new content record is created with no related contributor or content topic records

Component visibility is an app builder’s super power

As an app builder, I love Lightning App Builder and especially the component visibility feature. Component visibility gives me the power to filter a component to show only based on conditions I set. I knew for sure that I wanted to use component visibility to show a message to the Admin Relations team member if there’s no contributor or content topic record. Note: For the purposes of this blog, since the solution for no contributor and no content topic record is the same solution, just targeting different objects, we’re going to focus on the no contributor record solution going forward.

I needed a way to know whether a contributor record was created for the content record and use that to filter my message to the user. I created a custom picklist field [Yes/No (default)] on the Content object called “Has Contributors?” that is editable by the profiles or permission sets we use but isn’t visible on the content record itself.

Has Contributors? custom picklist field

I wanted to take the fun approach to my message that included an animated GIF. For the purposes of this blog, I chose an animated GIF of our Awesome Admin logo, instead of a cute GIF from a favorite show, which we can’t do here for copyright purposes. Do something fun and be creative with imagery and the message!

Fun and creative message to inform the user that a contributor record is missing

In Lightning App Builder, I added the Rich Text component to the content Lightning record page. I uploaded the animated GIF to Files, then copied and pasted the image in the Rich Text component. Next, I set the component visibility filter to “Has Contributors?” field equals “Yes,” which means this component would show to the user only if the content record’s “Has Contributors?” field is “Yes,” otherwise it would be hidden to the user.

Component visibility for the Rich Text component is filtered to “Has Contributors? field” equals “Yes.”

Update the field when the first contributor record is created with a record-triggered flow

Now that my cool message is in place, we need a way to automatically update the “Has Contributors?” field to “Yes” when a contributor record is created for the content record. My heart just flutters when I get to create automation! #AutomateAllTheThings

I created an after save record-triggered (RT) flow that triggers off the Contributor object when a record is created. An after save RT flow is a flow that invokes actions or impacts related records. In my case, when a contributor record is created, the flow determines whether the content record (a related record) is updated as a result.

Here’s the flow in a nutshell: (1) It first finds all the contributor records associated with the content record. (2) It assigns the count of contributor records to a variable. (3) Next, it determines whether there’s only one contributor record. (4) If there is only one contributor record, the flow update the associated content record’s “Has Contributors?” field to “Yes.”

RT flow that fires when a new contributor record is created

I configure this flow to execute on the contributor record when a record is created and optimized for actions and related records. I don’t set any condition requirements, as I want this to fire every time a new contributor record is created.

Configured Start element in the RT flow

Next, using the Get Records element, I query the Contributor object to find all the records associated to the same content record.

Configured Get Records to find all the contributor records associated with the content record

Using the Assignment element, I take the number of records from my Get Records element and assigned this to a number variable varRecordCount, which I’ll use in the next step.

Assignment element that adds the contributor records from the Get Records element to a number variable

Now, I’ll use a Decision element to determine whether there’s only one contributor record found in the Get Records or if there are more. For the outcome, I’m checking to see if there’s one record, so I look at the number in the variable varRecordCount and see if it equals “1.” If there is more than one contributor record, the flow ends.

Decision element to determine whether there’s one contributor record found

If there’s only one contributor record, (which means it must be the first), then I want to update the associated content record’s “Has Contributors?” field to “Yes” using the Update Records element.

Update Records element to update the “Has Contributors?” field to “Yes” for the associated content record

Update the field when a contributor record is deleted with an RT flow

The RT flow I created definitely covered the happy path where the user creates a contributor record, but what happens if the user deletes a contributor record (the only one) and doesn’t create a new one? This means the content record has no contributor record, but our “Has Contributors?” field is still set to “Yes.” Uh-oh, we have a data issue.

As admins, we should consider not only the happy path—when all things go as expected—but also what I call the exception path—what happens when things don’t go as expected. You would typically not expect a user to delete a contributor record once they created one, but what if the previous contributor (such as a second speaker) cancelled? In that case, I can see the user deleted the second speaker contributor record altogether. In this scenario, we assume there are still other contributor records, and therefore, we don’t need to show the no contributors message. But, if the one and only record was created, we should let the user know.

To address this, I created a second RT flow (actually, I saved a new version of my first RT flow and updated the Start and Update Record elements). This one handles the scenario of when a contributor record is deleted. This is very similar to the first RT flow, except this fires when a contributor record is deleted; and if there are no contributor records associated to the content record, it will update the content record’s “Has Contributors?” field to “No” to reflect no associated contributor records.

Here’s the RT flow in a nutshell: When a contributor record is deleted… (1) It first finds all the contributor records associated with the content record. (2) It assigns the count of contributor records to a variable. (3) Next, the flow determines whether there’s only one contributor record. (4) If there is only one contributor record, the flow updates the associated content record’s “Has Contributors?” field to “No.”

RT Flow to trigger when a contributor record is deleted

I configure this flow to execute on the contributor record when a record is deleted and is optimized for actions and related records. I don’t set any condition requirements as I want this to fire every time a contributor record is deleted.

Configured Start element in the contributor record deleted RT flow

Next, using the Get Records element, I query the Contributor object to find all the records associated to the same content record.

Configured Get Records to find all the contributor records associated with the content record

Using the Assignment element, I take the number of records from my Get Records element and assigned this to a number variable varRecordCount, which I’ll use in the next step.

Assignment element that adds the contributor records from the Get Records element to a number variable

Now, I’ll use a Decision element to determine whether there’s only one contributor record found in the Get Records or if there are more. For the outcome, because I’m checking to see if there’s one record, I look at the number in the variable varRecordCount and see if it equals “1.” If there’s more than one contributor record, the flow ends.

Decision element to determine whether there’s one contributor record found

If there’s only one contributor record (basically, the record the user deleted), then I want to update the associated content record’s “Has Contributors?” field to “No” using the Update Records element, which will show the missing contributors message.

Update Records element to update the “Has Contributors?” field to “No” for the associated content record

That’s it! Well, after you test both RT flows to ensure you see or don’t see the message accordingly, then you’re done.

Now, when there are no associated contributor records, the message will display, and when there’s at least one, it won’t.

Give it a test drive in your org

I hope this use case and solution inspires you to build something similar in your org when you need to ensure data quality but the records have a lookup relationship. And when you do, share it with us on Twitter by tagging @SalesforceAdmns.

To learn more about RT flows, check out the Automate This! playlist on our Salesforce Admins YouTube channel. You’ll find a few episodes on RT flows. Automate This! is a monthly content series that I stream live. You can always catch recorded episodes you miss.

Resources

Flow Enhancements Summer '24.

Flow Enhancements | Summer ’24 Be Release Ready

Summer ’24 is almost here! Learn more about new Flow Builder enhancements like the Automation App, Action Button (beta), and more, and check out Be Release Ready to discover more resources to help you prepare for Summer ’24.  Want to see these enhancements in action? Salesforce product manager Sam Reynard and I will demo some […]

READ MORE
A Salesforce Admin's Guide to TrailblazerDX 2024.

A Salesforce Admin’s Guide to TrailblazerDX 2024

The Trailblazer community is coming back together on March 6-7, 2024, in San Francisco and on Salesforce+ for TrailblazerDX 2024—join us! Generative artificial intelligence (AI) is revolutionizing application development, creating the most significant shift and opportunities for both admins and developers in decades. At TDX, you’ll learn to supercharge user productivity, automate business processes, and […]

READ MORE
Be Release Ready Spring '24 | The Ultimate Guide to Prompt Builder.

The Ultimate Guide to Prompt Builder | Spring ’24

Artificial intelligence (AI) is not a new concept to Salesforce or to Salesforce Admins. Over the years, Salesforce has empowered admins with a user-friendly interface for the setup and configuration of predictive AI features such as Opportunity Scoring, Lead Scoring, Einstein Bots, and more. The introduction of generative AI in Salesforce brings even more possibilities […]

READ MORE