0

i need workflow when status from s1 to s10 changes into one of status d1 to d10, to send email alert to user. if status comes from t7 to d1 or from d1 to s5 (example) workflow don't need to do anything. I will attach a picture how that should look a like, and code I already made.

enter image description here

Code:

AND( ISCHANGED(Disposition_Type__c), 

OR( ISPICKVAL(Disposition_Type__c , "ACR-AWAITING CREDIT REPORT (S)"), 
OR( ISPICKVAL(Disposition_Type__c , "DL-ISC-UNQUALIFIED LEAD"), 
OR( ISPICKVAL(Disposition_Type__c , "DL-ISC- Invalid Contact Detail"), 
OR( ISPICKVAL(Disposition_Type__c , "DL-ACR-CUSTOMER DECLINES"), 
OR( ISPICKVAL(Disposition_Type__c , "DL-CO SIGNER FOUND"), 
OR( ISPICKVAL(Disposition_Type__c , "DL-CR-UNQUALIFIED LEAD"), 
OR( ISPICKVAL(Disposition_Type__c , "DL-U-UNQUALIFIED LEAD"), 
OR( ISPICKVAL(Disposition_Type__c , "DL-AW-CUSTOMER DECLINE - RATE"), 
OR( ISPICKVAL(Disposition_Type__c , "DL-AW-CUSTOMER DECLINE"
OR( ISPICKVAL(Disposition_Type__c , "DL-INVOICE CANCELLED"), 
OR( ISPICKVAL(Disposition_Type__c , "DL-ISC-NOT INTERESTED"), 
OR( ISPICKVAL(Disposition_Type__c , "DL-EXTERNAL COLLECTIONS"), 
OR( ISPICKVAL(Disposition_Type__c , "DL-AW-CUSTOMER DECLINE"),
OR( ISPICKVAL(Disposition_Type__c , "DL-AWC-CUSTOMER DECLINE"),
OR( ISPICKVAL(Disposition_Type__c , "DL-AWC-CUSTOMER DECLINE"),
OR( ISPICKVAL(Disposition_Type__c , "DL-AWSC-CUSTOMER DECLINE- RATE"), 
OR( ISPICKVAL(Disposition_Type__c , "DL-AWSC-CUSTOMER DECLINE"),

ISPICKVAL(Disposition_Type__c , "")), 



OR( ISPICKVAL(PRIORVALUE(Disposition_Type__c ), "ISC-CALLED 1"), 
OR( ISPICKVAL(PRIORVALUE(Disposition_Type__c ), "ISC-CALLED 2"), 
OR( ISPICKVAL(PRIORVALUE(Disposition_Type__c ), "ISC-CALLED 3"), 
OR( ISPICKVAL(PRIORVALUE(Disposition_Type__c ), "ISC-CALLED 4"), 
OR( ISPICKVAL(PRIORVALUE(Disposition_Type__c ), "ISC-CALLED 5"), 
OR( ISPICKVAL(PRIORVALUE(Disposition_Type__c ), "ISC-CALLED 6"), 
OR( ISPICKVAL(PRIORVALUE(Disposition_Type__c ), "ISC-CALLED 7"), 
OR( ISPICKVAL(PRIORVALUE(Disposition_Type__c ), "ISC-CALLED 8"), 
OR( ISPICKVAL(PRIORVALUE(Disposition_Type__c ), "ISC-CALLED 9"), 
OR( ISPICKVAL(PRIORVALUE(Disposition_Type__c ), "ISC-CALLED 10"), 
OR( ISPICKVAL(PRIORVALUE(Disposition_Type__c ), "ISC-CALLED 11"), 
OR( ISPICKVAL(PRIORVALUE(Disposition_Type__c ), "ISC-CALLED 12"), 
OR( ISPICKVAL(PRIORVALUE(Disposition_Type__c ), "ISC-CALLED 13"), 
OR( ISPICKVAL(PRIORVALUE(Disposition_Type__c ), "ISC-CALLED 14"), 
OR( ISPICKVAL(PRIORVALUE(Disposition_Type__c ), "ISC-CALLED 15") 

))))))))))))))))))))))))))))))))

This is my custom statues but you can watch it like s1----s10 and like t1-----t10

2
  • What's your specific question?, where are you facing the issue? Commented Nov 29, 2016 at 16:12
  • It's working good some part. When i change it from ISC to DL, but when i change from some other status to DL, it sends email again. Commented Nov 29, 2016 at 16:15

1 Answer 1

1

That's not how OR syntax works (note the syntax is OR(logical1, logical2...)), but there is a better way:

2 = CASE(
    Disposition_Type__c,
    "ACR-AWAITING CREDIT REPORT (S)", 1,
    "DL-ISC-UNQUALIFIED LEAD", 1,
    // etc.
    0
) + CASE(
    PRIORVALUE(Disposition_Type__c),
    "ISC-CALLED 1", 1,
    "ISC-CALLED 2", 1,
    // etc.
    0
)

If you want to make it work with OR syntax, your compile size will be a lot higher, but it would be simpler to just use two OR clauses:

AND(
    ISCHANGED(Disposition_Type__c),,
    OR(
        ISPICKVAL(Disposition_Type__c, "..."),
        ISPICKVAL(Disposition_Type__c, "...")
        // etc
    ),
    OR(
        ISPICKVAL(PRIORVALUE(Disposition_Type__c), "..."),
        ISPICKVAL(PRIORVALUE(Disposition_Type__c), "...")
        // etc
    )
)

You're nesting them, and because of that you haven't grouped them quite how you thought you did.

0

You must log in to answer this question.

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