0

I've created a button called Assign to Me and have gotten it to correctly move a case from a queue to the current user and successfully change status to "Working". I'm struggling to get it to open up the cases in tabs (or even new windows) in the console.

{!REQUIRESCRIPT('/soap/ajax/31.0/connection.js')}
{!REQUIRESCRIPT('/support/console/29.0/integration.js')}
var caseIds = {!GETRECORDIDS($ObjectType.Case)};
var cases = [], tempCase, result;
while(caseIds.length) {
    tempCase = new sforce.SObject('Case');
    tempCase.Id = caseIds.shift();
    tempCase.OwnerId = '{!$User.Id}';
    tempCase.Status = 'Working';
cases.push(tempCase);
}

result = sforce.connection.update(cases);

location.reload()enter code here

I've tried adding window.parent.location.href="/console?tsid={!Case.ID)}". I've tried a for loop that runs through cases and tempcase with no luck. I've tried openPrimaryTab commands via console also without luck. Can someone help?!

1

I was able to sort this out.

{!REQUIRESCRIPT('/soap/ajax/31.0/connection.js')}
{!REQUIRESCRIPT('/support/console/44.0/integration.js')}
var caseIds = {!GETRECORDIDS($ObjectType.Case)};
var cases = [], tempCase, result;
var i = 0;
while(caseIds.length) {

    tempCase = new sforce.SObject('Case');
    tempCase.Id = caseIds.shift();
    sforce.console.openPrimaryTab(undefined,'/'+ tempCase.Id, true);
    tempCase.OwnerId = '{!$User.Id}';
    tempCase.Status = 'Working';
cases.push(tempCase);
}
result = sforce.connection.update(cases);

location.reload()
0

try this

while(var i =0; i < caseids.length; i++){
    sforce.one.navigateToSObject(​caseids​, 'detail');
}
  • Thanks for your suggestion! It's still not working but not throwing any errors. I'm not sure if we are using Salesforce One but we are using Console (could be the same thing). It's simply just not opening up tabs in console. – Justin Lubbert Oct 23 '18 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.