Skip to main content
Shannon Andreas が「#Flow」で質問

I have a case where I am trying to prevent users from entering a duplicate value in a field on the account. There is a parent account that may have 1 or more child accounts. The child account being created needs to have a unique "Site Number" compared to the other children accounts.

 

For example,

 

Parent Account = ABC Company (does not require a site number)

Child Account = 123 Company  = Site Number 123

Child Account = 456 Company = Site Number 456

Child Account = 789 Company = Site Number 789

 

User is now entering a new child account named 1001 Company and entered a Site Number of 123. I want the system to throw an error since that site number already exists on a related child account.

 

I am not using a screenflow at this point, but am using a record triggered flow. 

 

Here is my logic. 

 

Trigger: (NOT(ISBLANK({!$Record.ParentId})) && ISCHANGED({!$Record.Site_Number__c})) || (ISNEW() && NOT(ISBLANK({!$Record.ParentId})))

 

Get All Child Account Records from Parent AccountUsing Flow to find unique valuesDecision:

If Get All Child Account records is empty = true then exit flow

If Get All Child Account records is empty = false, throw an error that the site number is not unique.

 

Site number can be any alpha-numeric combination.

 

I did entertain the idea of a loop but was having issues.

 

There is also another validation on using unique number for site number. If an opportunity is closed won, the site number must be unique. 

 

So the first scenario catches it when the child account is being created and the second scenario catches anything that did not go through the original validation in scenario one.

 

Let me know if there is anything you can help me with. i would greatly appreciate it as I have been wracking my brain for months!

 

thanks,

 

Shannon

 

#Flow

3 件の回答
  1. 2024年12月9日 17:32

    Hi Shannon,

    If the site is unique every time, regardless of the account (parent or child), then you can use duplicate and matching rules. 

    However, you are correct that these rules cannot be used when the child site number can be the same as another child site number. In that case, you will need to go with the flow.

0/9000