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
BGrimesBGrimes 

Detecting if the user is in the Console?

    Hello. 

I have an odd issue that appears to have been occuring since users were given the Console view.  When cloning a case we override the retURL to redirect to an integration s-control.  All is fine and well when you do this outside of the Console as the javascript is: window.top.location.href = redirectURL.

Great.  the problem is that this fails with the Console is sends the user outside of by virtue of 'window.top'.  Now, if I replace that line with: window.location.href = redirectURL, it works while int he Console, but when cloning a case in the normal tab view, only the right frame is affected, and it looks off.

Is it possible to use something like document.referrer to tell me if they're in the Console and then to set the location accordingly?  In playing around, this is what I get as the referrer when cloning a case in the Console:

https://tapp0.salesforce.com/50050000003d5dq/e?clone=1&retURL=%2F50050000003d5dq%3Fisdtp%3Dmn%26retURL%3D%2Fui%2Fdesktop%2FDesktopMainDefaultPage%3Fisdtp%3Dmn&scontrolCaching=1&isdtp=mn

Has anyone had to do something like this?  Any help would be greatly appreciated.

Cheers.
Bryan
Best Answer chosen by Admin (Salesforce Developers) 
BGrimesBGrimes

Wow I haven't seen this in a while.  In the end it was pretty easy, below is a snippet of what I did:

 

var _loc = window.top.location.href; if (_loc.indexOf('DesktopPage') == -1) window.top.location.href = redirectURL; else window.location.href = redirectURL;

 

You'll see that I just latched onto a piece of the URL that the console always has, and if that is there then the reciret lcoation is changed.  PRetty easy and has worked 100% for a variety of things we've done where console screws up something or another.

 

All Answers

geis6geis6

I'm experiencing a similar problem.

 

Custom clone button works fine outside of the console

 

/{!Case.Id}/e?clone=1&retURL=/{!Case.Id}&00N700000022SWB='New Incident'&00N700000028niR=&00N700000028niY=&00N700000028nir=&00N700000028niE=&00N700000028nid=&00N70000002NADO=

 When using it inside the console, it provides a top and side panel to the case record, even if I ask it not to.

 

Cheers,

Ward

 

 

BGrimesBGrimes

Wow I haven't seen this in a while.  In the end it was pretty easy, below is a snippet of what I did:

 

var _loc = window.top.location.href; if (_loc.indexOf('DesktopPage') == -1) window.top.location.href = redirectURL; else window.location.href = redirectURL;

 

You'll see that I just latched onto a piece of the URL that the console always has, and if that is there then the reciret lcoation is changed.  PRetty easy and has worked 100% for a variety of things we've done where console screws up something or another.

 

This was selected as the best answer