I have created a custom button and added it to a console application. What happens is when a particular profile user do not do any activity then after 10 to 15 minutes on clicking the custom button user is redirected to dashboard.Also , when I return to the same page again I got a pop up on button click i.e problem with on click javascript. Invalid _session_ID fault code: invalid session.
{!requireScript("/soap/ajax/29.0/connection.js")}
var oppid = '{!Opportunity.Id}';
var get = null;
var cases = null;
var openCase = null;
var caseNumber = null;
var caseId = null;
var result = sforce.connection.query("SELECT Case__r.Id, Case__r.Status, Case__r.CaseNumber FROM Opportunity WHERE (Id = '{!Opportunity.Id}' AND Case__r.Status != 'Closed')");
if(result != null || typeof result != 'undefined')
{
get = result.getArray('records')[0];
if( get != null || typeof get != 'undefined')
{
cases = get.getArray('Case__r');
if(cases == null || typeof openCase == 'undefined' || cases.length == 0){
srcUp('/apex/LogACallVSFPage?opportunitid='+oppid);
} else if(cases.length > 1){
alert('There are multiple open cases on this loan. Please choose a case to log your call on.');
} else {
openCase = cases[0];
if(openCase != null || typeof openCase != 'undefined'){
caseNumber = openCase.get('CaseNumber');
caseId = openCase.get('Id');
} else {
alert('An error occured. Please contact your administrator.');
}
if( (caseNumber != null || caseNumber != 'undefined') && (caseId != null || caseId != 'undefined')){
if(confirm('There is an open case on this account. Please Go to Open Case ' + caseNumber + ' to Log the Call.')== true){
srcUp('/' + caseId);
}
} else {
alert('An error occured. Please contact your administrator.');
}
}
} else {
srcUp('/apex/LogACallVSFPage?opportunitid='+oppid);
}
} else {
alert('An error occured. Please contact your administrator.');
}
Please help me as I am also debugging the issue. It happens for a particular profile only.