• msantana
  • NEWBIE
  • 10 Points
  • Member since 2016
  • Salesforce Developer


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 7
    Replies
This is my first time developing a Custom Console Component.
Situation: I created a VF page that got added to a Custom Console Component in order to open as a Footer widget in the console.Footer widget view

This is what I need to do: The VF page should do: When you open a Case in the Console as a Primary TAB and the field__c is empty then the VF page should display Case.field1__c(lookup) in order update the case field when a Save button is click, to then later find the data from a related Object and display this data within VF page with or without the previously rendered filed that we just updated.

If the mentionded field already has a value then it would display the data from a related Object.

The PROBLEM that I am having:
    Not able to pass the CASE data from my currently open case in the Console as Primary tab to my custom Controller in order to find the data from a related Object.

My VF page:
<apex:page standardController="Case" extensions="CaseConsoleControllerExt2"> 
    <apex:includeScript value="/support/console/42.0/integration.js"/>
    <script type="text/javascript">
        //sforce.console.onCustomConsoleComponentButtonClicked(sforce.console.getFocusedPrimaryTabObjectId(response));
        function testGetFocusedPrimaryTabObjectId() {
            sforce.console.getFocusedPrimaryTabObjectId(showObjectId);
        }
        var showObjectId = function showObjectId(result) {
            //Display the object ID
            alert('Object ID: ' + result.id);
        };
    </script>
    <apex:pageMessages /><br/>
    
    <apex:form >
        <apex:pageBlock title="Edit Case" mode="edit">
            <apex:pageBlockSection columns="1">
                <apex:inputField value="{!Case.CaseNumber}"/> 
<!-- Not able to get data from the primary tab to display CaseNumber, ID, ETC -->
                <apex:repeat value="{!editableFields}" var="f">
                    <apex:inputField value="{!Case[f]}"/>
                </apex:repeat>
           </apex:pageBlockSection>
           <apex:pageBlockButtons>
               <apex:commandButton action="{!save}" value="Save"/>
           </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
    <A HREF="#" onClick="testGetFocusedPrimaryTabObjectId();return false">
     Click here to get the focused primary tab object ID</A>
</apex:page>
My Custom controller:
public class CaseConsoleControllerExt2 {
	private final Case MyCase;
    
    public CaseConsoleControllerExt2(ApexPages.StandardController stdController) {
        //this.editCase = [Select Id, CaseNumber,SAP_Customer__c FROM Case Where Id = :ApexPages.currentPage().getParameters().get('id') ];
        // this.MyCase = (Case)ApexPages.currentPage().getParameters().get('id');
        this.MyCase = (Case)stdController.getRecord(); // ALWAYS NULL
        system.debug('My current Case is: '+MyCase);  // ALWAYS NULL
        //stdController.addFields(editableFields);
    }
    
    public Case MyCase() {
        return MyCase;
    }

    
	public List<String> editableFields {
        get {
            if (editableFields == null) {
                editableFields = new List<String>();
                editableFields.add('SAP_Customer__c');
            }
            return editableFields ;
        }
        private set;
    }
}

My questions:
  1. Why my controller in not getting the data from my current record in the primary tab when ​doing this.MyCase = (Case)stdController.getRecord();
  2. How can I pass data from VF page script (Case data) to the controller since the I am getting the case Id with the script sforce.console.getFocusedPrimaryTabObjectId
  3. Any problem with my controller?
This is my first time developing a Custom Console Component.
Situation: I created a VF page that got added to a Custom Console Component in order to open as a Footer widget in the console.Footer widget view

This is what I need to do: The VF page should do: When you open a Case in the Console as a Primary TAB and the field__c is empty then the VF page should display Case.field1__c(lookup) in order update the case field when a Save button is click, to then later find the data from a related Object and display this data within VF page with or without the previously rendered filed that we just updated.

If the mentionded field already has a value then it would display the data from a related Object.

The PROBLEM that I am having:
    Not able to pass the CASE data from my currently open case in the Console as Primary tab to my custom Controller in order to find the data from a related Object.

My VF page:
<apex:page standardController="Case" extensions="CaseConsoleControllerExt2"> 
    <apex:includeScript value="/support/console/42.0/integration.js"/>
    <script type="text/javascript">
        //sforce.console.onCustomConsoleComponentButtonClicked(sforce.console.getFocusedPrimaryTabObjectId(response));
        function testGetFocusedPrimaryTabObjectId() {
            sforce.console.getFocusedPrimaryTabObjectId(showObjectId);
        }
        var showObjectId = function showObjectId(result) {
            //Display the object ID
            alert('Object ID: ' + result.id);
        };
    </script>
    <apex:pageMessages /><br/>
    
    <apex:form >
        <apex:pageBlock title="Edit Case" mode="edit">
            <apex:pageBlockSection columns="1">
                <apex:inputField value="{!Case.CaseNumber}"/> 
<!-- Not able to get data from the primary tab to display CaseNumber, ID, ETC -->
                <apex:repeat value="{!editableFields}" var="f">
                    <apex:inputField value="{!Case[f]}"/>
                </apex:repeat>
           </apex:pageBlockSection>
           <apex:pageBlockButtons>
               <apex:commandButton action="{!save}" value="Save"/>
           </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
    <A HREF="#" onClick="testGetFocusedPrimaryTabObjectId();return false">
     Click here to get the focused primary tab object ID</A>
</apex:page>
My Custom controller:
public class CaseConsoleControllerExt2 {
	private final Case MyCase;
    
    public CaseConsoleControllerExt2(ApexPages.StandardController stdController) {
        //this.editCase = [Select Id, CaseNumber,SAP_Customer__c FROM Case Where Id = :ApexPages.currentPage().getParameters().get('id') ];
        // this.MyCase = (Case)ApexPages.currentPage().getParameters().get('id');
        this.MyCase = (Case)stdController.getRecord(); // ALWAYS NULL
        system.debug('My current Case is: '+MyCase);  // ALWAYS NULL
        //stdController.addFields(editableFields);
    }
    
    public Case MyCase() {
        return MyCase;
    }

    
	public List<String> editableFields {
        get {
            if (editableFields == null) {
                editableFields = new List<String>();
                editableFields.add('SAP_Customer__c');
            }
            return editableFields ;
        }
        private set;
    }
}

My questions:
  1. Why my controller in not getting the data from my current record in the primary tab when ​doing this.MyCase = (Case)stdController.getRecord();
  2. How can I pass data from VF page script (Case data) to the controller since the I am getting the case Id with the script sforce.console.getFocusedPrimaryTabObjectId
  3. Any problem with my controller?
My code development environment conists of Apple MBP, Google Chrome browser and Salesforces native Developer Console tool. With the Google Chrome v56 update, scrolling up/down in developer console becomes extremely jumpy and it makes my experience extremely painful. I have to go on Safari and develop there as a workaround.

Is anyone else here experiencing this issue? Here's the related StackExchange topic. I would like to hear any solutions to this problem if there's any.
Hi
 
I am trying to add a widget in the console app. When Case is a primary tab, the widget shows the required VF page but when Case is subtab of Accounts, the VF page is not visible. The controller of VF page is using Case as Standard controller.
Can anybody help me, how to view this page in widget
Thanks in advance
Sushmita Sikha
How to pass id using the console functon "sforce.console.getFocusedPrimaryTabObjectId()" to a controller.
I'm getting the same on the javascript. But cannot pass. Tried using hiddenfield and actionfunction.
javascript:
function testGetFocusedPrimaryTabObjectId() {
            sforce.console.getFocusedPrimaryTabObjectId(showObjectId);
        }
        var showObjectId = function showObjectId(result) {
            //Display the object ID
            invokeController(result.id);
            alert('Object ID: ' + result.id);
        };

page:
<apex:actionFunction name="invokeController" action="{!save}" reRender="outtext">
            <apex:param value="{!primeTabValue}"/>
        </apex:actionFunction>
this is my code and in controller am using get; set; for the primeTabValue variable.

Am able to get the id on alert box. but not on the variable.

Any help would be much appreciated.


  • March 06, 2014
  • Like
  • 1

So this might be a bit of an odd request, but I'm looking for someone that could help guide me as I'm teaching myself Apex and VisualForce development. This person would be a resource for me when I get stuck to help keep me progressing in my proficiency with Apex and Visualforce development. I'm working through the workbooks and guides currently, but I know I'm going to need access to someone that can answer questions for me when I get stuck, or don't quite understand a topic. Sometimes you just need someone that you can talk to vs. reading and re-reading to get the solution.

 

The way I'd like to setup the relationship would be on an hourly basis where this person would bill me for the time used on a weekly/monthly basis as they help me progress in these areas.

 

Please contact me if you're interested.

 

Thanks!

 

- Ken

 

 

 

 

I finally got around to watching the adv testing and debugging webinar.  The new developer console looks to be greatly improved from the old one (which I was never able to make heads or tails of).  However, I noticed that some of the windows have scroll bars that will auto-magically scroll back up to the top of the window.  I am seeing this in the window when I look at class or trigger source code...scroll down by dragging the bar and when you let it go it scrolls back up to the top.  In fact it does this even if you do not let the bar go.  It is annoying and makes it almostt impossible to inspect the code, code coverage results, etc.

 

I am using Chrome on Windows.  Any one else seeing this?

I'm currently testing out Survey Force from Force.com Labs http://appexchange.salesforce.com/listingDetail?listingId=a0N30000003I2gDEAS

I
've manage to install, deploy and create my first survey, however when I select 'Email link with Contact & Case merge' it is not finding any sites to expose to. The only option I have is internal despite the fact I have a site enabled with the required vforce pages.

I am doing this in a sandbox, would this cause this to happen?

If anyone can advise, I would be very grateful!

Cheers,

Graeme

  • February 23, 2012
  • Like
  • 0