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

Owner Visualforce - Adapting for Console

I created a VF page for my users to help them take ownership of Accounts/Opps as SF doesn't handle it all that well for the way my org works.  To allow my users to use this new page, I created a custom formula field to replace the standard Opportunity Owner field.  When the click CHANGE on this custom field, it takes them to my VF page, which does all of the steps for them.


The issue I have is with users utilizing the Console view.  When they click the CHANGE button it redirects them away from console.  The way around this was to change the _target of the HYPERLINK in the formula field to _blank, thus opening in a new tab/window.  This is not clean at all from a usability standpoint as a single user may end up with dozens of tabs/windows open.


Are there any suggestions on a way to optimize this for console, while still making it a friendly experience for users not using the console?


In a perfect world, console users would stay on the same screen and the VF page would load within the Opportunity "Full View" frame of the console (the bottom left frame of the bellow image).  Once they save the VF page, the frame then loads with the Opp record.  All the while, users not on the console will experience this all within the same tab/window.


(Hope this is all clear...)


Console Example




I have faced the similar issue and the workaround i found is to use the java script


    else {'/{!}';


The sforce.console.isInConsole() checks whether you are in service console or another app.


Thanks, I'll give this a shot!


So I can't get sforce.console.isInConsole() to work within my script.  Played with it in multiple ways but it always comes out blank (not null, literally a blank value).  All tests seem to work, but as soon as I plug in sforce.console.isInConsole() it shows a blank value.  


I have been trying to play with the document object to get the top URL, but I seem to always pull "ui/desktop/DesktopPage", regardless of the page I am working out of.  Any other suggestions to get some boolean value of whether my user is in the console?


Add these Scripts--




and check if it works.....


In this example I am redirecting to a new page on button click, my page opens in Service console only


if (sforce.console.isInConsole()) {
srcSelf('/apex/VFP_TaskMassUpdate?isdtp=vw &Ids='+records+'&retURL='+returnURL);

alert('Please select at least one task.');



If you're interested, "isdtp" is short for "Is Desktop", the original name for Console. "vw" is short for "view", which is the mode in which the page is displayed.


Ahh I see what you did.  I was looking to have a dynamic VF page that would recognize if the top URL or previous page was console or not.  However, I could not get any of this to work...


For the time being I have resorted to your approach and just created a custom button that recognizes if the user is in console, thus sending them to separate VF pages.  Thanks for all of the help, someday I may tackle this, just dont have time or resources right now :)