function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rahul Luthra 1Rahul Luthra 1 

Urgent Help needed - flag on cases based on status and time

Hi Experts,

Below is the formula which flags the field based on the given condition but it is not working as expected. Could someone pls take a look and help to make the corrections.

In nutshell requirement is:
1.
update the flag to white whenever the status is set to Closed
2. Set the flag green if status is “In progress” or “Unread” and Created date time < 24 hrs
3. Set the flag green if status is “In Progress - Awaiting customer reply” or “Status ,"In Progress - Transferred off SF” or In Progress - Customer Replied
4. Set the flag red if status is “In progress” or “Unread” and Created date time > 24 hrs
5. when status “Reopened” and field Case_Age_including_re_open__c < 24hr, flag green and > 24 flag red.



//This will update the flag to white whenever the status is set to Closed
IF( 

(ISPICKVAL( Status ,"Closed - Resolved")) || 
(ISPICKVAL( Status ,"Closed - Spam")) || 
(ISPICKVAL( Status ,"Closed - Withdrawn")) || 
(ISPICKVAL( Status ,"Closed - Transferred off SF")) ,IMAGE("s.gif", "white", 15, 15), 


//Set the flag green if status is “In progress” or “Unread” and Created date time < 24 hrs
IF( 
OR((ISPICKVAL( Status ,"In Progress")), 
(ISPICKVAL( Status ,"Unread"))) && 
(FLOOR((NOW() - CreatedDate)*24) < 24), IMAGE("/img/samples/flag_green.gif", "green", 15, 15), 


// Set the flag green if status is “In Progress - Awaiting customer reply” or “Status ,"In Progress - Transferred off SF” or In Progress - Customer Replied
IF( 
OR((ISPICKVAL( Status ,"In Progress - Awaiting customer reply")), 
(ISPICKVAL( Status ,"In Progress - Transferred off SF")), 
(ISPICKVAL( Status ,"In Progress - Customer Replied"))), IMAGE("/img/samples/flag_green.gif", "green", 15, 15), 

// Set the flag red if status is “In progress” or “Unread” and Created date time > 24 hrs
IF( 
OR((ISPICKVAL( Status ,"In Progress")), 
(ISPICKVAL( Status ,"Unread"))) && 
(FLOOR((NOW() - CreatedDate)) > 24), IMAGE("/img/samples/flag_red.gif", "red", 15, 15), 



//when status “Reopened” and field Case_Age_including_re_open__c < 24hr, flag green
IF( (ISPICKVAL (Status, "Reopened"))&& 
(Case_Age_including_re_open__c)<24, IMAGE("/img/samples/flag_green.gif", "green", 15, 15), 

// when status “Reopened” and field Case_Age_including_re_open__c > 24hr, flag red
IF( (ISPICKVAL (Status, "Reopened"))&& 

(Case_Age_including_re_open__c)>24, IMAGE("/img/samples/flag_red.gif", "red", 15, 15), 
''))))))


TIA
Rahul
NehaDabas16NehaDabas16
Hi Rahul,

FLOOR((NOW() - CreatedDate) : this returns number of days and you have not multiplied it with 24 to get number of hours except the first instance.
Please make this correction and recheck.

If this helps, please like and mark resolved.