+ Start a Discussion

Trying to solve issue in JS, but maybe Visualforce is the way to go?

I posted an issue with a javascript button, but  in thinking on it, this may be better suited to a visualforce page.


If you wouldnt mind reading my issue and giving your feedback, I would greatly appreciate it.


I am trying to implement the service console and am stuck on a button issue.


Currently  I have a custom "New Case" button that displays within a contact.  It uses javascript to auto-pop some fields based on user settings


window.parent.location.href ="%2F500%2Fe?00N800000034wTE={!$User.Language_Support__c}&cas3_lkid={!Contact.Id}&00N80000003MDbe={!$User.Default_Country_cases__c}&retURL=%2F500%2Fo";


In testing within the console, this will load the case creation form outside the console.  To get around this, I am using the following code (some hard coding in place right now to eliminate variables):


if (typeof(srcUp) == 'function') 
} else {    
     window.parent.location.href ="%2F500%2Fe?00N800000034wTE={!$User.Language_Support__c}&cas3_lkid={!Contact.Id}&00N80000003MDbe={!$User.Default_Country_cases__c}&retURL=%2F500%2Fo";
Now the behavior is working in console (as well as if not in console), however I believe that because the button originates from a "Contact" page, that somehow the controller class is not changing to a case controller.  Even though the main page is laid out correctly, I am not getting the Knowledge or other side bars that should be there (getting contact one still).
Any suggestions on how to fix this, or a more elegant way of doing this would be appreciated.  The built in "New Case" works fine, but I need to pass some $user parameters into case fields during submission, all while remaining within console.