You need to sign in to do that
Don't have an account?
Jason L.ax300
s-control for closing a case
I want to create something to allow our support agents to quickly close cases that have the same case reason, resolution and time spent. (things like information requests, uploading a file etc etc) They spend about 10 minutes resolving minor, repetative support issues including fixing the issue, updating the case and sending the response to the client.
I'd like to be able to create a 'close - info request' custom button that invokes an s-control to do the following:
- update 6 or 7 case fields (standard and custom)
- close the case
- add a standard comment
- send solution or email to the case contact
Even updating the fields is a good start, just something to cut down the time they spend doing the same thing over and over.
I have a fairly good understanding of how I could use an s-control to do this, I just don't know where to get started. I've added AJAX toolkit and made a simple control that adds an account (from the tutorial) but I'm not sure where to start developing my own control.
hmmm, updating the fields seemed to be a lot easier than I thought. The only problem I'm having now is how to get the record ID for the current case that is being viewed:
var c = new sforce.SObject("Case");
c.id = "{!Case.Id}";
c.Origin= "Web";
c.Type = "Other";
c.Problem_Area__c = "Product";
c.Problem_Sub_Area__c = "module";
var result = sforce.connection.update([c]);
If I hardcode the Case.ID, it works fine, but I'm not sure what the syntax is to get the record ID of the page you're currently viewing.
c.id, c.ID, c.Id, c.iD and they are all different entities.
So, I think you're getting the case id correctly, you're just putting it in the wrong place.
Try c.Id (uppercase "I") and see if that does the job?
Steve.
yeah, that was it. It works great now. I haven't figured out the other stuff, but I think it's best to handle subsequent actions using workflow instead.
Is that the only code you used (above) or did you have supplementary code around it? And did you define it has a URL/HTML/Snippet?
I have a similar requirement where I need to close the Case via a Custom Button on the Case Layout.
I tried a S-Control but its taking me to the Case Close Layout..
Any Help is Appreciated...
Angel..
here is the code I used in the control. This updates the case with hard-coded params, closes the case and then returns to the case view page for the case it just closed.
If you need to update additional fields, install the AJAX tools and use the Explorer to find the names of the database fields you need to update.
<!-- start -->
<html>
<!--
Generated by AJAX tools
Date : Thu Aug 30 2007 12:27:14 GMT-0400 (Eastern Daylight Time)
Template : simple.html by manoj@cheenath.com
SControl : Update_Case
-->
<head>
<script src="/soap/ajax/8.0/connection.js"></script>
</head>
<body>
<Script>
var c= new sforce.SObject("Case");
c.id = "{!Case.Id}";
c.Origin= "Internal";
c.Type = "Support";
c.Reason= "Infrastructure";
c.Case_Sub_Reason__c = "False Alert";
c.Status = "Closed";
c.Time_Spent__c = ".1";
c.Resolution__c = "False Alarm";
var result = sforce.connection.update([c]);
if (result[0].getBoolean("success")) {
var urltogo = "/" + "{!Case.Id}";
window.parent.location.href = urltogo;
} else {
alert("failed to update record" + result[0]);
}
</script>
</body>
</html>
<!-- end -->
But did u used this code to Close the case or just to update the values of the particular Case ?
I tried it in my Org, Its not closing the case though is updating the Case values very well...
Angel...
Jason for me it not closing the case,
This is what i am putting in my code...
Code:
Again, just eyeballing, read my previous posting in this thread...
try _case.Status instead of _case.status.
Best, Steve.
It worked fine now...
Angel...