You need to sign in to do that
Don't have an account?
Access Service Console through Javascript
Hi,
Im opening New Tab in service console on click of button -invoking below VF page... New Tab/page is not opening sometimes...Sometimes working ..Y sometimes not working in IE & FireFox...
pls help me out....
code:
<apex:page standardController="case">
<script type="text/javascript" src="/js/functions.js"></script>
<script src="/soap/ajax/26.0/connection.js"></script>
<script src="/soap/ajax/26.0/apex.js"></script>
<apex:includeScript value="/support/console/26.0/integration.js"/>
<apex:form >
<apex:pageBlock >
</apex:pageBlock>
</apex:form>
<script>
window.onload = loadfns;
function loadfns()
{
var caseIds="{!$Request.newid}";
var sId='{!$Api.Session_ID}';
sforce.connection.sessionId=sId;
var result;
var queryString;
var accresult;
var accquerystring;
try{
queryString="Select Id,CaseNumber,AccountId,Type from case Where Id='"+caseIds+"'";
result=sforce.connection.query(queryString);
var resultRecords = result.getArray("records");
var caseAccountId=resultRecords[0].AccountId;
var caseRecId=resultRecords[0].Id;
var caseType=resultRecords[0].Type;
var caseName=resultRecords[0].CaseNumber;
if (sforce.console.isInConsole()){
sforce.console.openPrimaryTab(null,'/'+caseRecId, true, ''+caseName);
if(caseType=="Information Request" && caseAccountId!=null){
sforce.console.openPrimaryTab(null, '/apex/VFpage?scontrolCaching=1&Id='+caseAccountId, true, 'Lead Tab');
}
}
else{
window.location.href='/'+caseRecId;
}
}
catch(e){alert('Exception'+e);}
}
</script>
</apex:page>
Hi Kavi,
Please see the considerations that I can think of below.
When you refer to not opening, what is the behaviour is it giving any error etc?
If the button is clicked on the same record in a different browser other than IE & FF is it working fine?
Also, please enable debug logs and check if you find any clue.
Regards,
Ashish, Salesforce.com