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
Roshan TamrakarRoshan Tamrakar 

URL structure for Console Tab VS Detail Tab

I heard a little about isdtp=mn parameter.

I have a vf page inside Account under a section. A button in that page opens new case window. In order to achieve this I create a new url with the help of pagereference and returns to the page. This opens the case window. When I cancel, I am returned to the account and if I save I am returned to saved case.
It works fine. However if I do the same from the console window, the whole page is refreshed and the new case window is displayed (it should open within the Account detail frame). When I cancel/save, I am not returned to the console instead I returned to the Account (on cancel) or Case (on save).

Below is the code in s-control which I am converting to vf page with apex class.

Code:
var desktop = new DesktopApi();
if (desktop.desktopPageWindow) {
 parent.frames.location.replace('/'+result[0].id+'/e—retURL=%2F'+result[0].id+'%3Fisdtp%3Dmn%26retURL%3D%2Fui%2Fdesktop%2FDesktopMainDefaultPage%3Fisdtp%3Dmn&def_contact_id='+caseObj.ContactId+'&def_account_id='+caseObj.AccountId+'&isdtp=mn&saveURL=%2Fservlet%2Fservlet.Integration%3Flid%3D01N600000004hPk');
} else{
 parent.navigateToUrl('/'+result[0].id+'/e–retURL=%2F'+result[0].id+'&saveURL=%2Fservlet%2Fservlet.Integration%3Flid%3D01N600000004hPk');
}

 


I am not sure how I can do above in apex class.

My first issue..How could I know that I am in desktopPageWindow from apex class?
Second, If I got it...how my parameters will change?

Below is my method which I am currently using:

Code:
public PageReference CreateNewCase(Id retUrlId, Id contId, Id acId, String prmFunc, Id prmEntId, Id prmspId, String prmEntName){
        
 CaseOrigin = '&cas11='+EntUtil.GetDefaultPicklistValueFromCase('origin');
 Status = '&cas7='+EntUtil.GetDefaultPicklistValueFromCase('status');
 String sPriority = EntUtil.GetDefaultPicklistValueFromCase('priority');
 Priority = '&cas8='+sPriority;          
 
 PageReference page = new PageReference('/500/e—retURL=/'+retUrlId+CaseOrigin+Status+Priority);        
 page.setRedirect(true);
 return page;
 
}   

 Please help.

Thanks,
-Roshan