function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nick ValerioteNick Valeriote 

Flow Validation Rule To See if Field Value Already Exists

Hi SF Community,

I'm somewhat new to Flow, but managed to put together a Flow (with the help of this community) that allows users to click a button (Create SOW) on my Project__c object and fill in a screen that then creates an associated SOW record (SOW__c).

I have a Record Update element at the end of the Flow (see below screen shot) that grabs the SOW Name and adds it to a field called Related Account SOW on the associated project record.  

User-added image

User-added image

I'm looking for a way (maybe a validation through another element) to check to see if a value already exists in the Related_Account_SOW__c field, and if it does, warn the user and don't let them save the record.  We don't want them overwriting this field with a new SOW record if one already exists.

Any ideas?
Thanks!
Nick
Best Answer chosen by Nick Valeriote
Nick ValerioteNick Valeriote
Thanks again, Guarav.  Turns out I needed to remove the original condition ({!RelAccSOW} equals {!$GlobalConstant.EmptyString}), and replace it with the new condition you provided ({!RelAccSOW} is null true)...for each outcome.  Cheers!

All Answers

Gaurav HandooGaurav Handoo
Hi Nick

Happy to help again.

Using Current Flow

You would need to pass the said field as a variable in the initial URL itself by adding another variable "&RelAccSOW={!Project.Related_Account_SOW__c}", where RelAccSOW will be an input type variable with default value of "EmptyString" global constant.

Your Flow would start with a decision element validating if anything has come in the new varibale we just defined.
Condition1: RelAccSOW Equals EmptyString Global Constant
Condition2: RelAccSOW not Equals EmptyString Global Constant

Condition1: New Screen with a message stating SOW already created and with just a Finish Button.
Condition2: Carry on with the current screen and Flow.

Hope this helps. Please mark as best answer if it does.

Cheers!!
Gaurav
Nick ValerioteNick Valeriote
This is great, thanks, Gaurav.
However, it seems to work only for condition 1 (a SOW exists and the user can't go forward).  When I test this out on a project that does not have a value in the Related Account SOW field, it still gives me the warning message I created for the decision condition that thinks a SOW record already exists for said project.  Any ideas why this might be?  Here's how I set it up:

User-added image


User-added image


User-added image


User-added image

Thanks.
Gaurav HandooGaurav Handoo
Hi NIck

I think you need to add another condition for each outcome here viz
{!RelAccSOW} equals {!$GlobalConstant.EmptyString}
{!RelAccSOW} is null true

Add the similar condition with is null false for the other outcome.

Hope this helps.

Cheers!!
Gaurav
Nick ValerioteNick Valeriote
Thanks again, Guarav.  Turns out I needed to remove the original condition ({!RelAccSOW} equals {!$GlobalConstant.EmptyString}), and replace it with the new condition you provided ({!RelAccSOW} is null true)...for each outcome.  Cheers!
This was selected as the best answer