You need to sign in to do that
Don't have an account?
Srikanth Sunkara 23
javascript Custom Code Button
Hi,
I am having this code under Custom button click ffor case record and it works fine in Sales Cloud but the same code is not working as expected in service console(redirection to Case owner change page doesnt happen)
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
{!REQUIRESCRIPT("/support/console/29.0/integration.js")}
var recId = window.location.href.substring(window.location.href.lastIndexOf('/') + 1);
var c = new sforce.SObject("Case");
c.id = "{!Case.Id}";
// make the field change
//c.Agent_Handover_From__c= '{!$User.Id}';
c.Agent_Handover_From__c= '{!$User.FirstName}'+ ' ' + '{!$User.LastName}';
//{!$User.FirstName} {!$User.LastName}";
c.Agent_Handover_Time__c = new Date();
c.Stage__c='Sales HandOver';
c.RecordTypeId ='01290000000iaw4';
// save the change
sforce.connection.update([c]);
var redirectURL = '/'+ recId + '/' + 'a?retURL=%2F' + recId ;
//window.location = '/'+ recId + '/' + 'a?retURL=%2F' + recId ;
if (sforce.console.isInConsole()) {
sforce.console.getEnclosingTabId(function(enclosingResult){
sforce.console.getEnclosingPrimaryTabId(function(primaryResult){
sforce.console.openSubtab(primaryResult.id, redirectURL, true, '', null);
});
});
}
else {
window.location.href = redirectURL;
}
Can you please suggest the change in the code to make it work in service console.
Regards
Srikanth Sunkara
I am having this code under Custom button click ffor case record and it works fine in Sales Cloud but the same code is not working as expected in service console(redirection to Case owner change page doesnt happen)
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
{!REQUIRESCRIPT("/support/console/29.0/integration.js")}
var recId = window.location.href.substring(window.location.href.lastIndexOf('/') + 1);
var c = new sforce.SObject("Case");
c.id = "{!Case.Id}";
// make the field change
//c.Agent_Handover_From__c= '{!$User.Id}';
c.Agent_Handover_From__c= '{!$User.FirstName}'+ ' ' + '{!$User.LastName}';
//{!$User.FirstName} {!$User.LastName}";
c.Agent_Handover_Time__c = new Date();
c.Stage__c='Sales HandOver';
c.RecordTypeId ='01290000000iaw4';
// save the change
sforce.connection.update([c]);
var redirectURL = '/'+ recId + '/' + 'a?retURL=%2F' + recId ;
//window.location = '/'+ recId + '/' + 'a?retURL=%2F' + recId ;
if (sforce.console.isInConsole()) {
sforce.console.getEnclosingTabId(function(enclosingResult){
sforce.console.getEnclosingPrimaryTabId(function(primaryResult){
sforce.console.openSubtab(primaryResult.id, redirectURL, true, '', null);
});
});
}
else {
window.location.href = redirectURL;
}
Can you please suggest the change in the code to make it work in service console.
Regards
Srikanth Sunkara
maybe need to replace to function 'getFocusedSubtabObjectId()' or 'getFocusedPrimaryTabId()', which one chose decide by the object show in the console. And also you can use all and check by method.
i took a different approach to resolve the problem. I have implemented VF page with Extension controller to reditrect to a url and also update case values.it worked.
Regards
Srikanth Sunkara