0

I am trying to add another logical test to my formula. At the moment my formula checks the record type of an opportunity and generates a unique ID number in the formula field.

The formula works fine, and now I want the formula field to be populated when the opportunity stage equals "Invoice".

So basically,I want to add "ISPICKVAL( StageName , "Invoice")" to the below formula.

IF(OPCC__c = "" , IF(OPPS__c = "", IF(OPET__c = "", IF(LMS__c = "", "", LMS__r.CustAuto__c ), OPET__r.CustAuto__c ) , OPPS__r.CustAuto__c) , OPCC__r.CustAuto__c )

I am having trouble adding this criteria to the below formula as I am unsure of the syntax when using "IF" & "AND" Statements in formula's

Any help is appreciated.

Thank you

0

Wow, That's some mess. Could you give a record as example..

Also if you only wish to add ISPICKVAL( StageName , "Invoice") and If I under stand it correctly, then can you try this

IF(
ISPICKVAL( StageName , "Invoice"),
IF(OPCC__c = "" , 
IF(OPPS__c = "", 
IF(OPET__c = "", 
IF(LMS__c = "", 
"", 
LMS__r.CustAuto__c ), 
OPET__r.CustAuto__c ) , 
OPPS__r.CustAuto__c) , 
OPCC__r.CustAuto__c ),
"")
1
  • Perfect. That's what I needed A-D – GMan Jun 19 '14 at 11:50
0

If I understand what you want correctly, this should do the trick:

IF (
    ISPICKVAL(StageName , "Invoice"),
    IF (
        OPCC__c = "" , 
        IF (
            OPPS__c = "", 
            IF (
                OPET__c = "", 
                IF (
                    LMS__c = "", 
                    "", 
                    LMS__r.CustAuto__c 
                ), 
                OPET__r.CustAuto__c 
            ), 
            OPPS__r.CustAuto__c
        ),
        OPCC__r.CustAuto__c
    ),
    ""
)

I always find it easier to structure formulas in a code like manner, as complex formulas can get confusing.

1
  • Hi Davin, Thanks for the help. I think I am almost there. My formula now looks like this "IF(ISPICKVAL(StageName , "Invoice"),IF(OPCC__c = "" , IF(OPPS__c = "", IF(OPET__c = "", IF(LMS__c = "", "", LMS__r.CustAuto__c ), OPET__r.CustAuto__c ) , OPPS__r.CustAuto__c) , OPCC__r.CustAuto__c ))" But it is giving me the error "Error: Incorrect number of parameters for function 'IF()'. Expected 3, received 2" Any Ideas? – GMan Jun 19 '14 at 11:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.