#validation-rule — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #validation-rule, aggregated by home.social.
-
Four Tips for Leveraging Custom Errors in Flows
In Salesforce flows, the custom error element allows you to define and display custom error messages when a flow encounters an issue or when certain conditions are met. This feature enhances user experience and error handling by providing more specific and meaningful feedback than generic or system error messages.
For example, if a user attempts to submit a form without filling out all required fields, instead of being met with a standard, impersonal error, they are greeted with a custom message thoughtfully designed to point out the missing information. This level of specificity not only aids in quickly resolving the issue at hand but also contributes to a learning environment where users can better understand the system’s requirements through direct, relevant feedback.
This approach to error handling not only streamlines the problem-solving process but also significantly enhances the user experience by making interactions with the Salesforce platform more intuitive, less frustrating, and decidedly more engaging.
This recent addition to the flow builder offers specific functionality attributes resulting in UI risks that must be managed delicately.
Here are four tips to follow when leveraging the custom error elements in flow:
1️⃣ Insert the Flow Label and the System Fault Message
Insert the flow label into your record-triggered flow custom error message, or use a unique code to help you track where the message comes from. When appropriate, include the $Flow.FaultMessage as well.
2️⃣ Set The Most Effective Placement
You choose where the message is displayed in the Custom Error Element in record-triggered flows. It can be displayed at the bottom of the page in a list along with other messages or next to a field of your choice.
3️⃣ Avoid Using Custom Errors With Stage/Status
When a path component is present on the record page layout, a change of stage or status using this component produces an error message at the top of the screen that disappears quickly. The user won’t be able to read that message.
4️⃣ Validation Rule, Before Save and After Save Custom Errors Appear in Batches
If your entry triggers multiple messages and you have messages in multiple categories, you don’t see them all until you clear one batch. This UI behavior can be confusing. Build messages in one category only.
While custom error functionality can be used to block user transactions, other options should be exhausted before admins resort to this approach. Sharing and security settings, profiles, permission sets, and validations can provide the same or better UI when restricting user actions.
How do you leverage the custom error message component in flows? Have you come up with cool use cases? Please comment below!
Explore related content:
-
How Migrate to Flow Can Trip Your Custom Validations
Salesforce is guiding its users toward a unified automation platform with the impending “End of Support” for Workflow Rules and Process Builder. This transition sets Flow Builder as the future for declarative automation, offering a better, more intuitive interface capable of handling complex business processes.
To facilitate this transition, Salesforce introduced the “Migrate to Flow” tool, designed to convert existing automations into the modern Flow format. Organizations need to understand the nuances of this migration, as the tool has a few limitations. Let’s dive into what this change looks like and how to best prepare for it.
What Does “End of Support” Mean?
Salesforce announced that they will stop supporting Process Builders and Workflow rules by December 31, 2025. What does that mean? If your automations work the way they were intended, you do not have to migrate them to flow. You can leave them as they are for the time being. But, ideally you should consider migrating them to flow, knowing that Salesforce will not support you through their support/success ticketing platform if a problem occurs.
The migration tool plays a role in this transition by offering a method to convert existing automations built in Workflow Rules and Process Builder into the Flow format. However, is it truly as seamless and comprehensive as claimed? Depending on how the start criteria is built, and what actions are included (such as time delay actions), your legacy automations may not be supported by the Migrate to Flow tool.
Background: The Automation Evolution
Workflow Rules and Process Builder were instrumental in automating business processes without extensive coding. However, Flow has emerged as a stronger, unified solution.
Implications for Salesforce Users
For those relying on the old tools, transitioning requires a strategic plan. The main considerations are:
- Revisiting Automations: Check current automations for replication or improvement in Flow.
- Skill Development: Flow’s broader functionalities mean teams may need training.
- Planning Migration: Moving complex automations takes time, needing testing and iterations.
Navigating the Transition
To migrate smoothly:
- Conduct an Automation Audit: Document all old processes. Identify critical ones and optimization chances.
- Use Salesforce Resources: Salesforce provides documentation and community support for Flow learning.
- Develop a Phased Plan: Be intentional about which flows to tackle first.
- Test Thoroughly: Test Flow automations well before stopping old ones.
- Seek Expert Help: For complex migrations, consult a Salesforce expert for streamlined processes.
The Migrate To Flow Challenge
In addition to all the pain points mentioned, I faced another interesting challenge as a consultant on a migrate-to-flow project.
The organization in question utilized several workflow rules for field updates and email notifications. Their process aimed to flag Opportunities with a cautionary “You can’t touch this” label, while simultaneously alerting managers via email when the Account was flagged.
Here’s where it gets interesting: workflow rules have the unique ability to bypass validation rules. I am not sure why that’s the case, but workflow rules and processes were never bothered by custom validation rules built into the Org. Flows, on the other hand, adhere strictly to validation rules, introducing complexity to the migration process.
Validation Rule Road Block
After carefully migrating the workflow rules, I found that the resulting flow was tripping a validation rule.
The entry criteria of the originating workflow and the custom validation rule did not overlap 100%, either. I needed to re-engineer the whole thing. But I thought of ways I can move forward. I could build workarounds to bypass the validation rules for the flow to run. Jen W Lee and guest Parker Edelmann covered that here. However, that looked too complicated to be easily maintained in the future.
The Solution
I had reservations about the custom error functionality within record-triggered flows. I generally prefer not to stop a user’s action by throwing an exception. However, this feature ended up being the answer to resolving the migration challenge.
I incorporated a Decision element into the Flow. This element applied the necessary validation criteria after all required actions were executed. If the criteria were met (meaning the validation failed), a subsequent Custom Error Element displayed a clear, user-facing validation message.
This technique worked! It demonstrated how the custom error element can be used to effectively replace and replicate custom validation rules, offering a solution within Flow Builder.
The Recommendation
You may find that it is necessary to migrate some of your custom validations to flow in addition to your legacy workflow rules and process builder automations.
As Salesforce retires its legacy automation tools, migrations will not always be simple, but they are an opportunity. This shift forces orgs to take a closer look at the logic they have accumulated over the years, refine what no longer serves them, and rebuild with the clarity and capability that Flow provides. Whether you are tackling validation rule conflicts, rewriting complex logic, or rethinking your entire automation strategy, approaching this transition intentionally will set your org up for long-term stability.
Read more about what “End of Support” means for your workflows and processes HERE.
Do not hesitate to ask me your questions. I am here to help.
Read further on Migrate to Flow here
Getting back to the basics of Flow
Migrate to Flow (Beta) in Spring 22
#automation #development #management #migrateToFlow #salesforce #tips #troubleshooting #validation #validationRule #workflowRule