Skip to main content

#Validation Rule2 discussing

I am trying to configure a validation rule in my screen flow for the input of the address component. This consists of the Mailing Street, City, State, and Country. There is no "required" field to click on this component, so I am hoping to use a validation rule to make sure that all necessary fields are filled. Initially I had it set to check that all of the above fields were not blank, but in my testing I remembered that some countries do not have states. I have the list of countries with states, and I'm hoping to make a validation rule that considers the following:

 

If the country is one with states, then validate that all address fields are filled in. Else if the country is one without states, make sure that all fields except state are filled in. 

 

I am struggling to put the if, else statement in my head into a validation rule for the flow.

 

Also, validation rules in flow are different than fields within Salesforce, as the statement should return true if valid.

 

#Flow

13 answers
  1. Steven Trumble (Strum Consulting) Forum Ambassador
    Mar 1, 2024, 8:39 PM

    Sure, try this.

    Start with all the fields that should not be blank - street, city, country.

     

    Then you hvae two conditions. Either there is a Country with states (province), then state should have a value. or a country without states, then you don't need a value.

    AND(

    NOT(ISBLANK({!Address.street})),

    NOT(ISBLANK({!Address.city})),

    NOT(ISBLANK({!Address.country})),

    OR(

    AND(

    ISBLANK({!Address.province}),

    CASE({!Address.country},

    "Australia", 1,

    "United States", 1,

    "Mexico", 1,

    0

    ) = 0

    ),

    AND(

    NOT(ISBLANK({!Address.province})),

    CASE({!Address.country},

    "Australia", 1,

    "United States", 1,

    "Mexico", 1,

    0

    ) = 1

    )

    )

    )

0/9000

I have a date validation on a screen flow Needed_By>TODAY()+13 saying that the needed by date has to be in two weeks.. (there is also a default on the field of exactly two weeks)

 

I have no issue if i leave the default or make the default a later date, but when I make the date sooner, instead of showing the validation error message it gives me a fault:

 

Error element Request_Form (FlowScreen). The "6" value is a Text data type that's assigned to a field with an incompatible Number data type. Assign the value to a field with a compatible data type. #Flow #Screen Flow #Validation Rule

19 answers
  1. Eric Smith (Retired) Forum Ambassador
    Dec 5, 2023, 6:22 PM

    @Raquel Riemer Yes, I am aware of this issue and it has been resolved in v1.0.1 which is available in v3.2.5 of the FlowScreenComponentsBasePack.

    https://unofficialsf.com/flow-action-and-screen-component-basepacks/

0/9000

 

i completed the module . validation is also working but completion of the module is not happening

i completed the module .

 

 

 

#Trailhead Challenges  #Validation Rule

1 comment
  1. May 10, 2025, 5:13 PM

    HI @Samaparimal Reddy

     

     

    I am from the Trailhead Help Team. Can you please confirm if you're still seeing an issue? If yes, can you please let us know so that we can look into it and can help you further ? 

     

    Thank You! 

    ++TrailheadHelpFollowUp

0/9000

Hi, I have created a validation rule on moving the Opportunity stage to Closed/Won. I am checking multiple fields and the error message is quite long. Is there a way to display the message in separate lines.

My error message disappear after 5 sec that makes it very difficult to even read the message. My other validation errors stay put until I make the changes and hit save. Why this different behavior?

Is there any way to bypass it. Thank you!

 

#Validation Rule #Automation

12 answers
  1. Oct 13, 2021, 8:21 PM

    Okay, the issue is that the Validation Rule is being triggered and displayed on the Opportunity object, but it is referencing fields located on the Account object.  The behavior you're experiencing is totally normal for a Validation Rule with a Cross-Object Formula

0/9000

Looking for some ideas about how to create create and utilize promotion or discount codes in NPSP.  We will be utilizing an Experience Cloud site with a registration flow where users will be able to choose a membership level and submit payment through the flow.  We will want to be able to create and provide promotion/discount codes to some users, so that they can enter them in the flow and receive an immediate discount.  Some of the codes will be one-use codes and others will be provided to multiple people at a time. Thank you for any input! 

6 answers
  1. Nov 23, 2023, 9:46 PM

    @Elissa Stern I've seen this done in an Event App with custom metadata. 

     

    Essentially you create a custom metadata object called "Discount Codes". You add to it a field that stores the code "20OFF". You also can create a field that stores the percentage off, or dollar amount off. (you can do both, but it gets a little more complicated). Then a field for the expiration date.  ( There is no reason you can't do a similar thing with a custom object, particularly if you have a large volume of these.) Something to keep in mind is that you are gonna want the "20OFF"  to be a unique identifier within the expiration timeframe.  

     

    The tricky part is going to be providing a good UX in flow to actually check the discount.  Without a custom LWC, it will be hard to mimic the UX you are familiar with at most checkouts.  Click a button and get immediate feedback. ( It can be done though! but might not scale well if you have a large number of these active at one time.)

     

    Anyway, the sketch of it would be, to take the discount code entered by the end user. Attempt to retrieve the custom metadata object (done using the standard GET records node), check if you found one, and that the expiration hasn't passed. If so apply the discount. If not display a message telling the user that the code doesn't exist or is expired!

     

    Hope that helps!

0/9000
Hello again. I'm trying to write a validation rule that will prevent our sales people from moving an opportunity stage backward to "Prospect" after it has advanced past that stage. We have many stages, so the rule is rather lengthy. Please bear with me.

 

This is what I have so far:

 

OR(

 

ISPICKVAL( StageName, "Deferred Opportunity"),true, 

 

ISPICKVAL( StageName, "Webex Complete"),true,

 

ISPICKVAL( StageName, "Id. Decision Makers"),true,

 

ISPICKVAL( StageName, "GM/DP Webex needed"),true,

 

ISPICKVAL( StageName, "second Webex set"),true,

 

ISPICKVAL( StageName, "Second WX Complete"),true,

 

ISPICKVAL( StageName, "Third WX"),true,

 

ISPICKVAL( StageName, "Proposal/Price Quote"),true,

 

ISPICKVAL( StageName, "Onsite Visit Requested"),true,

 

ISPICKVAL( StageName, "Onsite Visit Completed"),true,

 

ISPICKVAL( StageName, "Negotiation/Review"),true,

 

ISPICKVAL( StageName, "Pending Installment Approval"),true,

 

ISPICKVAL( StageName, "Installments Approved"),true,

 

ISPICKVAL( StageName, "Closed or Won"),true,

 

ISPICKVAL( StageName, "Closed or Lost"),true,

 

IF(

 

ISPICKVAL(StageName, "Prospect"),true,false))

 

I'm not getting any syntax errors, but it won't let me place the opportunity into any stages other than "Prospect" when I'm testing it. Any stage other than "Prospect" throws the error message. Obviously we want to advance the stages forward, just not back to "Prospect".

 

As always, your help is greatly appreciated.

 

 

145 answers
  1. Oct 27, 2011, 6:17 PM

    Here's one I wrote using a CASE function and some basic math that you can hack up and use. 

     CASE( StageName , 

     "Prospecting",1, 

     "Qualification",2, 

     "Needs Analysis",3, 

     "Value Proposition",4, 

     "Id. Decision Makers",5, 

     "Perception Analysis",6, 

     "Proposal/Price Quote",7, 

     "Negotiation/Review",8, 

     "Closed Won",9, 

     "Closed Lost",9,0) 

     < 

     CASE(PRIORVALUE(StageName) , 

     "Prospecting",1, 

     "Qualification",2, 

     "Needs Analysis",3, 

     "Value Proposition",4, 

     "Id. Decision Makers",5, 

     "Perception Analysis",6, 

     "Proposal/Price Quote",7, 

     "Negotiation/Review",8, 

     "Closed Won",9, 

     "Closed Lost",9,0)

0/9000

Hi there , 

I am trying to figure out the best way to keep users from putting any internal mailbox addresses in the to/cc field when they are replying to the client or forwarding the new email cases to other internal teams. We have separate process to transfer cases to the other teams (Via screen flow). However, I am still seeing the examples where users are putting the mailbox addresses in the to/cc fields. 

 

There is now a flow that throw out the custom error when users put any internal team address in the field. The starting object is Email Message. All the email-to-case mailbox addresses are baked into Custom metadata (field: Transfer mailbox address) that flow fetches to show error if it finds one.   

 

Issues with email addresses string in the flow.

However,  it is not triggering when users are typing multiple email addresses (that also includes internal mailbox addresses) in to/cc field as this condition is not passing because whatever custom metadata record flow is finding it only matching to one email address and the to/cc field is represented as string (with multiple emails address, when present such as : 123@abc.com;675@abc.com,ourmailbox@xyz.com). I can't use CONTAINS in below Get Records condition direction [Transfer email address CONTAINS Record>toadderess) as I need to find a way to reverse to  [Record>toadderess CONTAINS Transfer email address ). OR find another way to find the mailbox adderss value from the to/cc address string. I think formula would help. Any help is greatly appreciated. Thank you, Mit  

 

email addresses.png

 

#Flow  #Formulas  #Salesforce Developer  #Automation  #Validation Rule

2 answers
  1. Michael Brown (Salesforce) Forum Ambassador
    Jun 21, 2024, 6:23 PM

    Hey Mit, 

     

    I wonder if you could do something that checks to see if the To Address and CC Address contains a ;. If so, that would indicate there are multiple addresses. 

     

    You could then have the flow essentially "loop" through that string, parse out each email address and check those individually. I've shared a response here that details how you can use flow to cycle through a comma separated string, or in this case semi-colon separated: https://trailhead.salesforce.com/de/trailblazer-community/feed/0D54V00007BID5hSAH

     

    Thanks,

    Mikey

0/9000

Hello there!

 

I'm having troubles with a validation rule and maybe someone can give me some advice or support.

 

I have three fields for Budget planing. 

  • Field 1 (Total Budget) indicates the total available Budget. 
  • Field 2 (Amount spent) indicates the total amount that will be spent. 
  • Field 3 (Remaining Budget) indicates the total remaining Budget.

So, I have created an easy validation rule, that restricts the Field 2 to be greater than Field 1. 

 

Field 2 >= Field 1

Logic, right? But now I'm having the problem, that I get an error message from the system if I try to spent the total available budget, so that Field 3 could be = 0 EUR. So, to avoid the validation error, I have to safe 1 EUR. 

 

In conclusion, I need to be able to spent all the Budget without exceeding the available amount, but no more... So why? What I'm missing?

 

Thanks in advance for your support :) 

 

#Validation Rule

5 answers
  1. Steven Trumble (Strum Consulting) Forum Ambassador
    Aug 12, 2024, 4:06 PM

    Could be. Do you have any other validation rules running on this object or these fields?

    Make sure you do thorough testing before deploying to production, but I'm quite confident the formula is correct.

0/9000

Step not yet complete in ----- Playground

 

An unexpected error occurred while inserting Opportunity records and we couldn't check your work. Make sure Opportunity records can be inserted in this org, and click "Check Challenge" again. If this continues, contact the Trailhead Help team.

47 answers
  1. Dec 19, 2023, 2:11 PM

     https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007UpAE7SAN 

     

    Hello, I have resolved my error. #Validation Rule

    here are the steps:-

    • First click setup then open object manager.
    • Second click opportunity then open field dependencies.
    • Third edit field dependencies and make sure every lost and won values are included then save it then check your challenge.

    One more point I'm adding... There are two pages in the lost and won... So try to select all and not only the 1st page values...

0/9000
4 answers
  1. Oct 3, 2023, 8:49 PM

    @Anmol Gupta Yes, that should not be a problem. You can access the Parent field something like this: Parent__r.FieldAPIName

0/9000