+ Start a Discussion
DeptonDepton 

Compiled formula is too big to execute 5,509

Hi,

 

Anyone has an idea to avouid the error: Thanks!!:)

 

IF( date1__c > 2, 
IMAGE("/img/samples/color_red.gif", "red", 30, 30),
IF( date1__c > 1,
IMAGE("/img/samples/color_yellow.gif", "yellow", 30, 30),
IMAGE("/img/samples/color_green.gif", "green", 30, 30)))

 Error: Compiled formula is too big to execute (5,509 characters). Maximum size is 5,000 characters

 

 

Best Answer chosen by Admin (Salesforce Developers) 
DeptonDepton

workaround:

 

or2__c is now: Pending_User_Date_WF__c

 

IF( 
ISPICKVAL( 
Status , "Completed") , 
IF(AND(MOD( 
TODAY()-DATE(1900,1,7),7)< ( ClosedDate - Pending_User_Date_WF__c ), 
((ClosedDate - Pending_User_Date_WF__c )<7)), 
((ClosedDate - Pending_User_Date_WF__c)-2) * 24, 
((ClosedDate - Pending_User_Date_WF__c)-(2 * ((ClosedDate - Pending_User_Date_WF__c)/7))) * 24), 
IF(AND(MOD( 
TODAY()-DATE(1900,1,7),7)< (NOW() - Pending_User_Date_WF__c ), 
((NOW() - Pending_User_Date_WF__c )<7)),((NOW() - Pending_User_Date_WF__c)-2) * 24, ((NOW() - Pending_User_Date_WF__c)-(2 * ((NOW() - Pending_User_Date_WF__c)/7))) * 24))

This is a formula number field that counts the hours a case is opened (once i have populated the  Pending_User_Date_WF__c via a WFFU

 

my first field was counting days, however this one also avoids weekends!!:)

 

Then i can use the first formula text field and I succcesfully got my images and a compile size of 1935 characters!:)

 No syntax errors in merge fields or functions. (Compiled size: 1,935 characters)

 

All Answers

Navatar_DbSupNavatar_DbSup

Hi,

 

Can you tell me which data type you are using for "date1__c" field??

DeptonDepton

Hi Navatar,

 

Thank you!! is a formula number to know how many days a case has been with an specific status

 

CASE( 
MOD(DATEVALUE(or2__c) - DATE(1900, 1, 7), 7), 
0, (TODAY() - DATEVALUE(or2__c)) - 1 - FLOOR((TODAY() - DATEVALUE(or2__c))/7)*2, 
1, (TODAY() - DATEVALUE(or2__c)) - FLOOR((TODAY() - DATEVALUE(or2__c))/7)*2, 
2, (TODAY() - DATEVALUE(or2__c)) - FLOOR((TODAY() - DATEVALUE(or2__c))/7)*2, 
3, (TODAY() - DATEVALUE(or2__c)) - FLOOR((TODAY() - DATEVALUE(or2__c))/7)*2, 
4, (TODAY() - DATEVALUE(or2__c)) - FLOOR((TODAY() - DATEVALUE(or2__c))/7)*2, 
5, (TODAY() - DATEVALUE(or2__c)) - 2 - FLOOR((TODAY() - DATEVALUE(or2__c))/7)*2, 
6, (TODAY() - DATEVALUE(or2__c)) - 2 - FLOOR((TODAY() - DATEVALUE(or2__c))/7)*2, 
null)

So when a case has specific status: a workflow field update populates the  "or2__c "

 

DeptonDepton

workaround:

 

or2__c is now: Pending_User_Date_WF__c

 

IF( 
ISPICKVAL( 
Status , "Completed") , 
IF(AND(MOD( 
TODAY()-DATE(1900,1,7),7)< ( ClosedDate - Pending_User_Date_WF__c ), 
((ClosedDate - Pending_User_Date_WF__c )<7)), 
((ClosedDate - Pending_User_Date_WF__c)-2) * 24, 
((ClosedDate - Pending_User_Date_WF__c)-(2 * ((ClosedDate - Pending_User_Date_WF__c)/7))) * 24), 
IF(AND(MOD( 
TODAY()-DATE(1900,1,7),7)< (NOW() - Pending_User_Date_WF__c ), 
((NOW() - Pending_User_Date_WF__c )<7)),((NOW() - Pending_User_Date_WF__c)-2) * 24, ((NOW() - Pending_User_Date_WF__c)-(2 * ((NOW() - Pending_User_Date_WF__c)/7))) * 24))

This is a formula number field that counts the hours a case is opened (once i have populated the  Pending_User_Date_WF__c via a WFFU

 

my first field was counting days, however this one also avoids weekends!!:)

 

Then i can use the first formula text field and I succcesfully got my images and a compile size of 1935 characters!:)

 No syntax errors in merge fields or functions. (Compiled size: 1,935 characters)

 

This was selected as the best answer