You need to sign in to do that
Don't have an account?
Issue with javascript button within Service Console need advice please
I am trying to implement the service console and am stuck on a button issue.
Currently I have a custom "New Case" button that displays within a contact. It uses javascript to auto-pop some fields based on user settings
Ex:
window.parent.location.href ="%2F500%2Fe?00N800000034wTE={!$User.Language_Support__c}&cas3_lkid={!Contact.Id}&00N80000003MDbe={!$User.Default_Country_cases__c}&retURL=%2F500%2Fo";
In testing within the console, this will load the case creation form outside the console. To get around this, I am using the following code (some hard coding in place right now to eliminate variables):
Hmmm. "External" means that the console hasn't recognized the page as a salesforce or case page, which is why the knowledge sidebar is now showing.
For the srcUp target url, can you try the following -
/500/e?00N800000034wTE={!$User.Language_Support__c}&cas3_lkid={!Contact.Id}&00N80000003MDbe={!$User.Default_Country_cases__c}
and also just
/500/e?
I want to ensure that it's not just the url that makes the console think that it's not a case page.
All Answers
Hi Erite11,
When you use srcUp, is a new subtab being created?Or is the existing subtab navigating to the new case page?
The knowledge sidebar and case custom components should load.
Can you also try the "srcSelf" method? Just use the exact same call, just change the method name from srcSelf to srcUp.Curious to know what the result is in that case.
Using SrcSelf is loading within the current frame and subtab, however it is leaving other subtabs around ti tied to the Contact Object page layout (still has a left panel from contact). This behavior does not update upon case save, and if you refresh the subtab, it goes back to contact view.
Using SrcUp, I get a new subtab on same level referenced as "external" instead of correct case info. Upon saving a case in this tab, I do not get anything that should be present on a case view (Knowledge panel etc), and am in fact taken out of a console view entirely.
Hmmm. "External" means that the console hasn't recognized the page as a salesforce or case page, which is why the knowledge sidebar is now showing.
For the srcUp target url, can you try the following -
/500/e?00N800000034wTE={!$User.Language_Support__c}&cas3_lkid={!Contact.Id}&00N80000003MDbe={!$User.Default_Country_cases__c}
and also just
/500/e?
I want to ensure that it's not just the url that makes the console think that it's not a case page.
Figured it out, thanks to your suggestion! Many thanks, and for anyone else in need, here is what was done.
Taking gvasudev's suggestion, I tried the url at the top.
This changed the behavior somewhat, in that it went to fullscreen (non console), but was different than prior tries. So I then added the isdtp=vw to the end of it, and it then stay in tab, and recognized the case object. However, because it was changing the same subtab, it was still keeping the original Contact panes. So I then used SrcUp instead of SrcSelf, and I was given a new subtab for case object that has all case related panes available.
I am going to do some more testing to ensure there are no discrepancies, but both the console and nonconsole urls are appearing to work correctly.
Again, many thanks for the help!
Great! Happy to help.
Hi,
I am also facing the same issue. In my project, we developed one visual force page and added to the orders (Orders__c) custom object. In that VF Page, we used to custom buttons called as New case for creating the new case in SFDC.
When the user clicks on the New Case custom button, the corresponding action method will invoke and as a result it redirects to the case creation screen.
Here, when we are working in Service Console, when the user clicks the new case button from the order detail page, it redirects to the sales screen. But, we want to open the new case screen in service console as a sub tab.
I used javascript function srcUP() in that VF Page.
<script type="text/javascript">
function openNewCaseInSubTab(){
srcUp("/500c0000001xoHA?isdtp=vw"); here, i hardcoded the value for testing purpose.
}
</script>
But, iam not getting the sub tab for created case.
Can you please check and support me to fix this issue.
Thanks in advance.
Regards,
kumar
Hi Kumar,
If you are on a visualforce page, there's no need to use srcUp. Just use the Service Cloud Console Integration Toolkit. srcUp is not supported in Visualforce.
So in the button JS, put the following
{!REQUIRESCRIPT("/support/console/27.0/integration.js")}
sforce.console.openSubtab(..url, subtabnamehere);
Put the name of the subtab in the directly into the open subtab call.
Hi gvasudev,
Thanks for the response.
I tried to use of sforce.console.openSubtab method in my VF page. But, i am getting the error like:
URL No Longer exists......
I placed the code below. Please check and suggest me how to fix this issue.
VF Page:
<apex:page standardController="Orders__c" extensions="Order_Header_Component_Controller">
<apex:includeScript value="/support/console/23.0/integration.js"/>
<script>
var button;
function disableButton()
{
button.disabled = true;
}
function changeButton()
{
alert("Change has been sent to ECC.");
}
</script>
<script type="text/javascript">
function openNewCaseInSubTab() {
sforce.console.getEnclosingPrimaryTabId(openSubtab);
}
var openSubtab = function openSubtab(result) {
var primaryTabId = result.id;
var URLValue = "https://c.cs14.salesforce.com/ui/support/servicedesk/ServiceDeskPage"+{!NewCaseId}+"?isdtp=vw";
alert("Value of the URLValue......"+URLValue);
sforce.console.openSubtab(primaryTabId,'URLValue', true,'New Case', null, openSuccess, 'NewCaseSubtab');
};
var openSuccess = function openSuccess(result) {
if (result.success == true) {
alert('subtab successfully opened');
} else {
alert('subtab cannot be opened');
}
};
</script>
<apex:pageBlock mode="maindetail">
<apex:commandButton action="{!newCase}" oncomplete="openNewCaseInSubTab(); return false;" value="New Case" rerender="redirectPanel" id="newCase" onclick="disableButton();"/>
<script type="text/javascript">
button = document.getElementById('{!$Component.newCase}');
</script>
</apex:pageblock>
Apex Controller:
public void newCase()
{
try {
List<Orders__c> oo = [SELECT Id FROM Orders__c WHERE Order_Num__c =: o.Order_Num__c Limit 1];
isRedirecting = true;
system.debug('Value of isRedriecting in newCase method>>>>>'+isRedirecting);
Case newCase = new Case(OwnerId = UserInfo.getUserId(),
Subject = 'Order: ' + o.Side_Marks_Txt__c,
Reference__c = o.Order_Num__c,
Original_Order__c = oo[0].Id,
AccountId = o.AccountID__c,
Status = 'New',
Origin = 'Web',
RecordTypeId = '012E0000000LbAyIAK');
insert newCase;
newCaseId = '/'+newCase.Id;
} catch (Exception e) {
System.debug('*** Exception ***: ' + e);
}
}
Thanks in advance.
Regards,
kumar
You have an error in your URL that is causing the problem.
You have:
which is missing a # and a /
Should be
Give that a try!!
<apex:includeScript value="/soap/ajax/26.0/connection.js"/>
<apex:includeScript value="/support/console/31.0/integration.js" />