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
alvatsealvatse 

Rquiring Case Reason upon closing a Case

Earlier, we implemented a custom button to close Case on the Case Details page, instead of using the standard Close Case Page Layout. Now we're faced with a challenge: we want to make the Case Reason required *only* upon Case closure. Here's what I've tried so far:

 

Build a validation rule to look for Status = Closed and Case Reason = null; if the condition is true, throws an error message saying 'Case Reason is required'. Here's the error formula:

 

Error Condition FormulaAND(ISPICKVAL (Reason, ""),
ISPICKVAL(PriorValue(Status), "In Progress"),
ISPICKVAL (Status, "Closed"))

 

The validation rule works but the problem is it first re-directs to the standard Case Close page and gives the error there, instead of giving the error on the Case Details page.

 

 

Making the Case Reason a required field won't work either b/c we only want to force data input upon closure.

 

Is there a solution to this? thanks.

SwarnasankhaSwarnasankha

Could you please share the details of how you implemented the custom button as it would help in figuring out the solution to your current problem with the validation.

alvatsealvatse

Hi, it's done as a button using S-control and here's the code. Thanks in advance.

 

<!-- begin code --> 
<!-- replace 'Closed' (without quotes) in the code below with the Status desired for case closure --> 

<html> 
<head> 
<script src="/soap/ajax/8.0/connection.js"></script> 
<script src="/desktop/desktopApi.js"></script> 

<script> 
function init() { 

var desktop = new DesktopApi(); 
if (desktop.desktopPageWindow) 

window.parent.location.href = "/{!Case.Id}/s?save=1&notifyContact=0&cas7=Closed&&#8203;isdtp=mn&nooverride=1&retURL=/{!Case.Id}"; 
} else { 
window.parent.location.href = "/{!Case.Id}/s?save=1&notifyContact=1&cas7=Closed&&#8203;nooverride=1&retURL=/{!Case.Id}"; 


</script> 
</head> 
<body onload="init()"> 
<p>&nbsp;</p> 
</body> 
</html> 

<!-- end code -->