Discussions
- General Development
- Schema Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules
- Security
- Mobile
- Force.com Sites & Site.com
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby
- Desktop Integration
- APIs and Integrations
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- AppExchange Directory & Packaging
- Salesforce Labs & Open Source Projects
- Other Salesforce Applications
- Jobs Board
- Force.com Discussion Boards
- :
- Developer Boards for Force.com and Database.com
- :
- Java Development
- :
- Take Case button functionality
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Take Case button functional ity
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-08-2012 08:32 AM
Please see my button code below. What we want is for Status and Substatus to only change is Closed <> True. Is there a way to make this happen?
{!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")}
var caseObj = new sforce.SObject("Case");
caseObj.Id = '{!Case.Id}';
caseObj.OwnerId = '{!$User.Id}';
caseObj.Status = 'In Progress'
caseObj.Substatus__c = 'Open with Support Advocates';
var result = sforce.connection.update([caseObj])
if (result[0].success=='false') {
alert(result[0].errors.message);
} else {
window.parent.location.href="/{!Case.Id}/e?retURL=
}
Re: Take Case button functional ity
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-27-2012 02:24 AM
Perform the logic when, the case is not closed! Use if statement for that.
I believe by closed you mean status is not closed.
Updated Code:
{!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")}
if('{!Case.Status}' != 'Closed'){
var caseObj = new sforce.SObject("Case");
caseObj.Id = '{!Case.Id}';
caseObj.OwnerId = '{!$User.Id}';
caseObj.Status = 'In Progress'
caseObj.Substatus__c = 'Open with Support Advocates';
var result = sforce.connection.update([caseObj])
if (result[0].success=='false') {
alert(result[0].errors.message);
} else {
window.parent.location.href="/{!Case.Id}/e?retURL= %2F{!Case.Id}";
}
}
else{
alert('This functionality does not supports closed case!!');
}

