You need to sign in to do that
Don't have an account?
Julian Davis 7
Help with amends to an opportunity validation rules formula
Hello
I'm looking for some help on some formula code that sits within an opp validation rule which pre-existed in the organisaiton that I work for, but that we now want to try and amend in order to get any record with a newly added opp record type to ignore.
The formula code is as follows:
---------------------------------------------------------------------------------------------------------------------------------
AND(
OR(ISPICKVAL( StageName , "Complete - Won"),
ISPICKVAL( StageName , "Complete - Won (Products Dropped)")
),
OR(ISPICKVAL( Contract__r.Status, "Draft" ),
ISPICKVAL( Contract__r.Status, "In Approval Process" )
),
OR (RecordTypeId <> $Setup.RecordTypeID__c.Opportunity_Consulting_Opportunity__c,
RecordTypeId <> $Setup.RecordTypeID__c.Opportunity_MC_Credit__c)
)
---------------------------------------------------------------------------------------------------------------------------------
We added the "RecordTypeId <> $Setup.RecordTypeID__c.Opportunity_MC_Credit__c" line to try to get the formula to ignore any opps that come through with a record type of "Opportunity_MC_Credit__c".
The test record that we’re struggling with has the following values:StageName = "Complete - Won"
Contract__r.Status = "Draft"
RecordTypeID__c = “Opportunity_MC_Credit__c”
When the record goes through this code it fires an error message and stops us closing the opportunity that its on.
What we want to know is - does this code make sense in terms of its logic? Which of the three blocks of code is actually running when we pass our record through with the above parameters? Just one of the blocks? More than one? Does the code run in a particular order? If the criteria is met on the first block of code does it then stop there? Or does it continue until its checked all three blocks?
Really hoping I’m making some sense! and many thanks in advance for your help.
I'm looking for some help on some formula code that sits within an opp validation rule which pre-existed in the organisaiton that I work for, but that we now want to try and amend in order to get any record with a newly added opp record type to ignore.
The formula code is as follows:
---------------------------------------------------------------------------------------------------------------------------------
AND(
OR(ISPICKVAL( StageName , "Complete - Won"),
ISPICKVAL( StageName , "Complete - Won (Products Dropped)")
),
OR(ISPICKVAL( Contract__r.Status, "Draft" ),
ISPICKVAL( Contract__r.Status, "In Approval Process" )
),
OR (RecordTypeId <> $Setup.RecordTypeID__c.Opportunity_Consulting_Opportunity__c,
RecordTypeId <> $Setup.RecordTypeID__c.Opportunity_MC_Credit__c)
)
---------------------------------------------------------------------------------------------------------------------------------
We added the "RecordTypeId <> $Setup.RecordTypeID__c.Opportunity_MC_Credit__c" line to try to get the formula to ignore any opps that come through with a record type of "Opportunity_MC_Credit__c".
The test record that we’re struggling with has the following values:StageName = "Complete - Won"
Contract__r.Status = "Draft"
RecordTypeID__c = “Opportunity_MC_Credit__c”
When the record goes through this code it fires an error message and stops us closing the opportunity that its on.
What we want to know is - does this code make sense in terms of its logic? Which of the three blocks of code is actually running when we pass our record through with the above parameters? Just one of the blocks? More than one? Does the code run in a particular order? If the criteria is met on the first block of code does it then stop there? Or does it continue until its checked all three blocks?
Really hoping I’m making some sense! and many thanks in advance for your help.
Let me explain what happens.
In the first block you will get 'TRUE' because your OR-statement becomes OR(TRUE, FALSE) and this is TRUE.
In the second block you will again get 'TRUE' because your OR-statement becomes OR(TRUE, FALSE) and this is TRUE.
Your third block will become OR(TRUE, FALSE) and this is also TRUE.
In total you get AND (TRUE, TRUE, TRUE) = TRUE.
If I understand correctly, you want for the third block a FALSE because you want to ignore 'any opps that come through with a record type of "Opportunity_MC_Credit__c"'. You will get this by using AND instead of OR: AND (TRUE, FALSE) = FALSE.
So your formula becomes:
Hope this helps! Please let me know if not.