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
Udaya BhaskarUdaya Bhaskar 

Help needed on save&close button on Case Page

    Hi All,

I have a requirement where i need  to report all the cases that are closed directly on first call. For this i am using the field, closed when created to capture the needed information. But unfortunately,this field is not getting populated with the value. On our analysis, we have found that this is because of overriding close button. we have overridden the close button to include business rules. is there any way how i can capture whether a case is closed by save& close button or by close button.

Pls reply me.

Thanks,
Udaya
Best Answer chosen by Admin (Salesforce Developers) 
HardhatHardhat
So you want to know whether the user pressed Save & Close or if he just saved it and then closed it later?  The IsClosed field is only a boolean, and will always be populated whenever the case is closed, so that won't help you.
 
What you should do is create a custom field ("1-Click Close", for example), default it to True, and override the Close button such that it sets this field to False whenever it's clicked.  That way if the person hits Save & Close there will be no override and the value will remain true; if he later hits the close button then the override will be called and the value will be false.
 
To find your one click closes later just make a report to find cases where IsClosed=True and 1-Click Close=True.

All Answers

HardhatHardhat
So you want to know whether the user pressed Save & Close or if he just saved it and then closed it later?  The IsClosed field is only a boolean, and will always be populated whenever the case is closed, so that won't help you.
 
What you should do is create a custom field ("1-Click Close", for example), default it to True, and override the Close button such that it sets this field to False whenever it's clicked.  That way if the person hits Save & Close there will be no override and the value will remain true; if he later hits the close button then the override will be called and the value will be false.
 
To find your one click closes later just make a report to find cases where IsClosed=True and 1-Click Close=True.
This was selected as the best answer
Udaya BhaskarUdaya Bhaskar
Hi,
 
Still the problem is not solved. i have over ridden the close button., but even when i press save & close or close button, on both situations, the control is going to the s-control that is used to over ride close buttton. i am not able to find out whether the action is initiated by save& close or close button by the user.
pls give me some pointers on this.
 
Thanks a lot for all the help and guidance.
 
Regards,
Udaya
 
BunnyBoyBunnyBoy
One possibility is to examine the document.referrer property in your close s-control.  The parameters appear to be different depending on whether you close using Close or Save and Close.  I couldn't say how robust that solution will be long-term. 
 
If you can tolerate a small percentage of error, an Apex trigger could check the timestamp to see if the Create and the Close events are within a certain time period (+/- 5 minutes, for example) and draw a conclusion from that regarding whether they were closed immediately, then populate your reporting flag from the trigger.