0

We have an existing "days in stage X" formula for Opps that works, but I need to wrap it so that it runs one calculation or a second calculation based on record type, so basically If Record Type = A, then run a formula with A's variables, and if Record Type = B, then run the same formula with B's variables.

The formula as it exists right now (for time in stage 1) is:

IF(NOT(ISBLANK(Stage_2_Scope_Changed_Date_Stamp__c)), DATEVALUE(Stage_2_Scope_Changed_Date_Stamp__c) -  DATEVALUE(Stage_1_Qualify_Changed_Date_Stamp__c),
            IF(AND(ISBLANK(Stage_2_Scope_Changed_Date_Stamp__c),  IsClosed = FALSE),  TODAY() - DATEVALUE(Stage_1_Qualify_Changed_Date_Stamp__c), 
                        IF(AND(ISBLANK(Stage_2_Scope_Changed_Date_Stamp__c), IsClosed = TRUE),  CloseDate - DATEVALUE(Stage_1_Qualify_Changed_Date_Stamp__c),0)))

We have 5 of these formulas that work for each stage 1-5, but the varying stage name labels for different record types was overlooked at first.

So I need to take that, create a second set of the same formula with a different record type's stage value date stamp names, and have the top level of the formula figure out which of the two calculations to run based on the record type.

I've tried a few approaches but have run into nothing but syntax errors, so I would very much appreciate any advice. Thanks in advance!

2 Answers 2

0

The CASE function should work and be somewhat clean to read / maintain

CASE(RecordType.DeveloperName,
     'foo', formula for foo recordType,
     'bar, formula for bar recordType,
     NULL
    )
0

The If function should work for this condition just like : If(RecordType.Name='A',formula for RecordType A,'') else If(RecordType.Name='B',formula for RecordType B,'') you can also use case statement for this.I hope this will help you.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .