0

As seen on the image some of records has flags and some are not even though there is a value on SLA Category and Case Age. Here is my formula:

IF(
(OR(
    AND(TechSLACategory__c=1,
        TECHCaseAge__c>=6),
    AND(TechSLACategory__c=2,
        TECHCaseAge__c>=8),
    AND(
        OR(
            TechSLACategory__c = 3,
            ISPICKVAL(Priority, 'Urgent')), 
        TECHCaseAge__c>=4)

)),IMAGE("/img/samples/flag_red.gif", "Red"),
IF(
    (OR(
        AND(
            TechSLACategory__c = 1,
            TECHCaseAge__c<=5,
            TECHCaseAge__c>=3),
        AND(
            TechSLACategory__c = 2,
             TECHCaseAge__c  <= 7,
            TECHCaseAge__c  >= 4),
        AND(
            (OR(
                TechSLACategory__c = 3,
                ISPICKVAL(Priority, 'Urgent'))), 
            TECHCaseAge__c<=3,
            TECHCaseAge__c>=2)
    )
),IMAGE("/img/samples/flag_yellow.gif","Yellow"),
IF((
    OR(
        AND(
            TechSLACategory__c = 1,
            TECHCaseAge__c<=2,
            TECHCaseAge__c>=0),
        AND(
            TechSLACategory__c = 2,
            TECHCaseAge__c<= 3,
            TECHCaseAge__c>=0),
        AND(
            (OR(
                TechSLACategory__c = 3,
                ISPICKVAL(Priority, 'Urgent'))),
            TECHCaseAge__c<=1,
            TECHCaseAge__c>=0)
    )

), IMAGE("/img/samples/flag_green.gif","Green"),""
)
)

)enter image description here

enter image description here

enter image description here

4
  • 2
    Welcome to SFSE! Right now, it's not clear what your problem is, or how your included image relates to it. If your formula isn't working the way you think it should, then either your formula is wrong or your expected outcome is wrong. It's impossible to tell without having some concrete examples though. Please edit your question to include some concrete examples (e.g. record has field values x, y, z, should result in red, but results in green). – Derek F Sep 24 '20 at 2:57
  • @DerekF I edited my question. please look into the formula so you can understand what I mean. – Sherwin Mier Betonts Sep 24 '20 at 3:48
  • I believe based on your screenshots that the specific issue here is that Cases with Tech Case Age = 2 and Tech SLA Category = 1 are not displaying a flag (although the headers on your second screenshot are cut off). The formula appears to be aiming to mark those cases with a Green flag. Is that accurate? Can you provide more examples of data that does not perform as expected? I can't immediately spot the error in this formula, although it'll be a little bit easier to read if you remove redundant parens and apply a bit more formatting. – David Reed Sep 26 '20 at 18:31
  • the way to debug this is to create some temporary formula fields that you can display on your page layout - each formula field corresponds to each of the ORs; and if need be, you can do additional formula fields for each AND. Then redefine (clone) your main formula field to reference the other formula fields (in other words, decompose the problem to something you can test visually) – cropredy Sep 27 '20 at 3:50

Your Answer

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

Browse other questions tagged or ask your own question.