Can anyone kindly help me with with following salesforce formula I have been trying to write.
Formula is getting fairly complex and large due to number of conditions. Basically there are 4 status fields, for budget, schedule, scope and participation. budget and schedule status are already formula fields while scope and participation being picklists. Now there are 2 more fields (picklists) budget status override and schedule status override. If override fields has values they take priority in calculating overall status. I have been trying to write overall status formula but this is just crossing formula compilation limit of 15k bytes.
This is what I have written.
IF(
OR(
ISPICKVAL(Project_Schedule_Override__c,"Red"),
ISPICKVAL(Project_Budget_Override__c,"Red")
),
"Red",
IF(
AND(
ISBLANK(TEXT(Project_Schedule_Override__c)),
NOT(ISBLANK(TEXT(Project_Budget_Override__c))),
OR(
ISPICKVAL( ProjectScope_Status__c ,"Yellow"),
ISPICKVAL( Participation_Status__c ,"Yellow"),
ISPICKVAL( Project_Budget_Override__c,"Yellow"),
Project_Schedule_Status__c = "Yellow"
)
),
"Yellow",
IF(
AND(
ISBLANK(TEXT(Project_Budget_Override__c)),
NOT(ISBLANK(TEXT(Project_Schedule_Override__c))),
OR(
ISPICKVAL(ProjectScope_Status__c , "Yellow"),
ISPICKVAL( Participation_Status__c ,"Yellow"),
Project_Budget_Status__c = "Yellow",
ISPICKVAL(Project_Schedule_Override__c,"Yellow")
)
),
"Yellow",
IF(
AND(
ISBLANK(TEXT(Project_Schedule_Override__c)),
ISBLANK(TEXT(Project_Budget_Override__c)),
OR(
ISPICKVAL( ProjectScope_Status__c ,"Red"),
ISPICKVAL( Participation_Status__c ,"Red"),
Project_Budget_Status__c = "Red",
Project_Schedule_Status__c = "Red"
)
),
"Red",
IF(
AND(
ISBLANK(TEXT(Project_Schedule_Override__c)),
ISBLANK(TEXT(Project_Budget_Override__c)),
OR(
ISPICKVAL( ProjectScope_Status__c ,"Yellow"),
ISPICKVAL( Participation_Status__c ,"Yellow"),
Project_Budget_Status__c = "Yellow",
Project_Schedule_Status__c = "Yellow"
)
),
"Yellow",
"Green"
)
)
)
)
)