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
NPanterNPanter 

Javascript custom button and opening a case in service console

Hi all, 

I am writing a custom button to 'quick close' a case and then open the oldest open case owned by a queue.  Everything is working wonderfully, however when the RetURL runs, it tells me the URL no longer exists.  This button would be run via the service console, so I have used the URL for that.  Anyone have an idea of where the issue is? Code is below....

{!REQUIRESCRIPT("/soap/ajax/22.0/connection.js")} 
 
var result = sforce.connection.query("Select Id,CreatedDate From Case where Status !=
'Closed' and OwnerId = 'xxxxxxxxxxxxxxxxx' ORDER BY CreatedDate LIMIT 1");
var records = result.getArray("records");
var oldestCaseId = records[0].Id
 
//window.parent.location.href = "/{!Case.Id}/s?save=1&notifyContact=0&cas7=Closed&nooverride=1&retURL=/ui/support/servicedesk/
ServiceDeskPage#%2F"+oldestCaseId+"%3Fisdtp%3Dvw%26isWsVw%3Dtrue";
 
window.parent.location.href = "/{!Case.Id}/s?save=1&notifyContact=0&cas7=Closed&nooverride=1&retURL=/ui/support/servicedesk/
ServiceDeskPage#";

The code works when I run the above, however when I run the currently commented out line (and comment out the second line), it gives me the error.
 
Any ideas?