2
votes

Is it possible to override the standard 'Create new ' button and 'detail' link in the list view of service cloud console?

I want to show my custom VF pages on click of these buttons/links.(if yes how?)

In addition, any examples to the service cloud API toolkit would be helpful.

Thanks in advance.

1

1 Answers

2
votes

Best would be to create separate set of buttons as it's less redirects...

If you want to really override standard ones I think you'll have to use normal overrides (on all buttons) but with content based on Javascript you'd be deciding what should happen.

http://www.salesforce.com/us/developer/docs/api_console/index.htm - Console JS API will be handy.

Make a visualforce page that uses standardController="Your_Object__c". In the content include a reference to the Console API and code similar to this example of isInConsole():

<apex:includeScript value="/support/console/27.0/integration.js"/>
<script type="text/javascript">
    function testIsInConsole() {
        if (sforce.console.isInConsole()) {
              alert("in console");
           } else {
              alert("not in console");
        }
    }
</script>

Except you'll be redirecting either to your special pages or to standard "new" and "edit". To force going to original edit mode you can add nooverride=1 parameter in the URL (which is also mentioned in the documentation of URLFOR function).

Normal "new Account" (results in override if specified): /001/e

Force go to your page: /apex/NewAccount

Force go to standard page: /001/e?nooverride=1

So now you have an idea how to detect whether you're in console or not and where to go. Only remaining question is "which window should redirect". Because Console is built on frames you might get different results on using javascript window, location, parent etc. objects. That's a general knowledge how to work with frames in JS so I'm not going to write that up. But I'll include a link to srcUp() function provided by salesforce that you might want to reuse.

I think it's defined only in Console context to be honest so maybe you could ditch the whole isInConsole in favor of typeof srcUp != 'undefined'?

Good luck :)