• Abhishek Saraf
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies
Console Layout

I am working on console app where we are getting case details, From the image: their is a section on left hand side name as
Case Navigation which a VF Page, I want to use the section to navigate into page detail section and also it should point to the particular section of case details section let say details, I have tried every thing to achive this, but their is no sucess, It would be helpful for me if someone can give me idea for the problem Thank You 

MY VF Page  Code

<apex:page standardController="Case">
    
    <apex:includeScript value="/support/console/26.0/integration.js"/>
    <apex:includeScript value="/soap/ajax/26.0/connection.js"/>
    <!-- Javascript For Navigation-->
    <script>
    
    var CaseID;
    var subTAB;
    
    function openNewSubtab() {
       
        sforce.console.getFocusedPrimaryTabObjectId(showObjectId);
        sforce.connection.sessionId = '{!$Api.Session_ID}';
        if (sforce.console.isInConsole()) { 
            sforce.console.getEnclosingPrimaryTabId(openSubtabs);
            sforce.console.getFocusedSubtabId(showTabId);
        }
    }
    
    var openSubtabs = function openSubtabs(result) {
        console.log(result.id);
        sforce.console.openSubtab(result.id,'/',false,'PR Contact 1',null);
        
    };  
    
    var showObjectId = function showObjectId(result) {
        //Display the object ID
        //alert('Object ID: ' + result.id);
        console.log(result.id);
        caseID= result.id;
    };
    
    var showTabId = function showTabId(result) {
        // Display the tab ID
        subTAB = result.id;
        console.log(result.id);
        //alert ('Tab ID: ' + result.id);
        //sforce.console.closeTab(subTAB);
        
    };
    
    </script>
    
    <apex:form >
        <apex:commandButton value="Navigate" onclick="openNewSubtab();"/>
    </apex:form>
</apex:page>


 
I have created a  new button on standard page of a Custom Object, which is calling a pop-up window, for that I have wrote following code

JS code On Cllick on button for  Standatrd Object Page
alert('Hi');
 var newWin=null;
(function(){
})();
function closeSuggestedPopup()
{
window.location.reload();
}


//Following is the VF Pop-up VF Page

<apex:page standardController="Contact_Centre_Campaign__c" extensions="CC_CallListQueueLookup" showHeader="false" sidebar="false">
    
    <script>
       
    function setID(elem){
        var queueID = elem.options[elem.selectedIndex];
        var hiddenElem = document.getElementById('{!$Component.seletForm.hiddenId}');
        var queueName = document.getElementById('{!$Component.seletForm.QueueName}');
        hiddenElem.value = queueID.value;
        queueName.value = queueID.text;
        window.alert(hiddenElem.value+ queueName.value);
        
    }
    function CloseWindow(){
           alert('hi');
    }
    
    </script>
    
    
    <apex:form id="seletForm">
            <apex:actionFunction action="{!reAssignQueue}"  name="CallreAssignQueue"/>
            <apex:outputLabel value="{!$Label.Queues}"></apex:outputLabel>
             &nbsp; &nbsp;
             <apex:inputHidden value="{!Contact_Centre_Campaign__c.HiddenQueueID__c}" id="hiddenId"/>
             <apex:inputHidden value="{!Contact_Centre_Campaign__c.Queue__c}" id="QueueName"/>
            <apex:selectList multiselect="false" id="selectQueue" size="1" onchange="setID(this);">
                <apex:selectOptions value="{!items}"></apex:selectOptions>
            </apex:selectList>
            <apex:commandButton action="{!reAssignQueue}" value="Assign Queue" onComplete="javascript:CloseWindow()"/>
          
    </apex:form>
</apex:page>

I have tried same approch with VF page and that was working but for standard Object page it is not working and after oncomplete action I am getting following error
'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://c.cs9.visual.force.com' is therefore not allowed access.


 
Hi All,

When i click on any row using onrowclick function in apex:pageBlockTable. I am able to select the row using javascript functionality but i am not able to get the selected row data to from vf page to controller/avascript to populate selected row data in alert box.

Can any one help me How to get selected row data in controller? 

Please find the vfpage and controller

Visualforce Page
 
<apex:includeScript value="{!URLFOR($Resource.jquery,'/js/jquery-1.4.2.min.js')}" /> 
<script> $j = jQuery.noConflict(); 
var lastRow; 
var sample = document.getElementById('Name').value; 
var firstname1 = document .getElementById('{!$Component.form.pageBlockContact.Name}').value; 
function highlight(elem)
{ if(lastRow != undefined)
lastRow.style.backgroundColor = 'white';
elem.style.backgroundColor = 'yellow'; lastRow = elem;
alert('DDDD'+firstname1 );
alert('DDDDDDD'+sample); 
} 
</script>
<apex:form id="form"> 
<apex:pageBlock id="pageBlockContact"> 
<apex:pageBlockSection columns="1"> 
<apex:pageBlockTable value="{!list1}" var="item" rules="rows" id="example" onRowClick="clickElem(this);"> 
<apex:column value="{!item.Name}" id="Name" styleclass="name" /> 
</apex:pageBlockTable> 
</apex:pageBlockSection>
<apex:commandButton action="{!ok}" value="ok" /> 
</apex:pageBlock>
</apex:form>
</apex:page>

Controller
 
public class SampleController {

    public PageReference ok() {
        return null;
    
    }
    
    public List<Claims__c> list1 { get; set; }

   
    public SampleController ()
{
   list1 = [select id,name from claims__c];
}

}

Output: Based on above vf page and controller
User-added image
  • January 02, 2015
  • Like
  • 1
I have created a  new button on standard page of a Custom Object, which is calling a pop-up window, for that I have wrote following code

JS code On Cllick on button for  Standatrd Object Page
alert('Hi');
 var newWin=null;
(function(){
})();
function closeSuggestedPopup()
{
window.location.reload();
}


//Following is the VF Pop-up VF Page

<apex:page standardController="Contact_Centre_Campaign__c" extensions="CC_CallListQueueLookup" showHeader="false" sidebar="false">
    
    <script>
       
    function setID(elem){
        var queueID = elem.options[elem.selectedIndex];
        var hiddenElem = document.getElementById('{!$Component.seletForm.hiddenId}');
        var queueName = document.getElementById('{!$Component.seletForm.QueueName}');
        hiddenElem.value = queueID.value;
        queueName.value = queueID.text;
        window.alert(hiddenElem.value+ queueName.value);
        
    }
    function CloseWindow(){
           alert('hi');
    }
    
    </script>
    
    
    <apex:form id="seletForm">
            <apex:actionFunction action="{!reAssignQueue}"  name="CallreAssignQueue"/>
            <apex:outputLabel value="{!$Label.Queues}"></apex:outputLabel>
             &nbsp; &nbsp;
             <apex:inputHidden value="{!Contact_Centre_Campaign__c.HiddenQueueID__c}" id="hiddenId"/>
             <apex:inputHidden value="{!Contact_Centre_Campaign__c.Queue__c}" id="QueueName"/>
            <apex:selectList multiselect="false" id="selectQueue" size="1" onchange="setID(this);">
                <apex:selectOptions value="{!items}"></apex:selectOptions>
            </apex:selectList>
            <apex:commandButton action="{!reAssignQueue}" value="Assign Queue" onComplete="javascript:CloseWindow()"/>
          
    </apex:form>
</apex:page>

I have tried same approch with VF page and that was working but for standard Object page it is not working and after oncomplete action I am getting following error
'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://c.cs9.visual.force.com' is therefore not allowed access.