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
Andrew marshal 3Andrew marshal 3 

Create a validation rule for this

Help me to create a validation rule ensures that accounts in the Technology or Finance industries have a minimum Annual Revenue of 1 million, and that accounts with Annual Revenue less than 1 million have an existing opportunity that is not closed or won.
Best Answer chosen by Andrew marshal 3
SubratSubrat (Salesforce Developers) 
Hello Andrew , 

Please try with below rule :
 
AND(
OR(
ISPICKVAL(Industry, "Technology"),
ISPICKVAL(Industry, "Finance")
),
OR(
AnnualRevenue < 1000000,
NOT(ISBLANK(
[SELECT COUNT()
FROM Opportunity
WHERE AccountId = Id
AND IsClosed = false
AND IsWon = false
AND RecordType.DeveloperName = 'New Business'
]
))
)
)

Hope the above rule helps !
Thank you.

All Answers

SubratSubrat (Salesforce Developers) 
Hello Andrew , 

Please try with below rule :
 
AND(
OR(
ISPICKVAL(Industry, "Technology"),
ISPICKVAL(Industry, "Finance")
),
OR(
AnnualRevenue < 1000000,
NOT(ISBLANK(
[SELECT COUNT()
FROM Opportunity
WHERE AccountId = Id
AND IsClosed = false
AND IsWon = false
AND RecordType.DeveloperName = 'New Business'
]
))
)
)

Hope the above rule helps !
Thank you.
This was selected as the best answer
Eswar Venkat 2Eswar Venkat 2

Hey Andrew,

 

AND(
    OR(
        ISPICKVAL(Industry, "Technology"),
        ISPICKVAL(Industry, "Finance")
    ),
    AnnualRevenue < 1000000,
    NOT(
        EXISTS(
            SELECT Id 
            FROM Opportunity 
            WHERE AccountId = Id 
            AND (StageName != 'Closed' AND StageName != 'Won')
        )
    )
)
 

 

 

We Provide Salesforce Interview and Work Support.
Interested People DM. (SalesfoceInterview4uBuddy@gmail.com)

Prateek Prasoon 25Prateek Prasoon 25
AND(
OR(
ISPICKVAL(Industry, "Technology"),
ISPICKVAL(Industry, "Finance")
),
AnnualRevenue < 1000000,
NOT(
ISBLANK(TEXT(Existing_Opportunity__c)))
)

In the formula above, replace "Existing_Opportunity__c" with the API name of your Opportunity lookup field on the Account object that indicates whether an opportunity exists for this account or not.

If you find my answer helpful, please mark it as the best answer. thanks!
RoadSea UrchinRoadSea Urchin
AND( OR( ISPICKVAL(Industry, "Technology"), ISPICKVAL(Industry, "Finance") ), AnnualRevenue < 1000000, NOT( ISBLANK(TEXT(Existing_Opportunity__c))) )
In the formula above, replace "Existing_Opportunity__c" with the API name of your Opportunity lookup field on the Account MyVanillaCard (https://www.myvanillacard.us/)
object that indicates whether an opportunity exists for this account or not.

If you find my answer helpful, please mark it as the best answer. thanks!


I agree with your thought.