• klab
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 9
    Replies

Hi all-

When looking at the documentation for force:recordEdit, https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/aura_compref_force_recordEdit.htm, it appears that there is something missing or there is a typo under the 'recordId' attribute.

recordId -- String -- The Id of the record to load, optional if record attribute is specified.

Can someone comment on what 'record' attribute is referring to? Is there supposed to another attribute listed that is not? Based on the description, it seems that the component can be initialized with an sObject by passing in either a record Id or an sObject record, but the 'record' attribute doens't appear to exist, so how is 'recordId' optional?  I would like to pass in a record instead of a record Id if possible.

Thank you!

  • April 24, 2017
  • Like
  • 0
Has anyone ever used actionSupport with the <apex:detail> tag when inlineEdit is set to true? I'm having trouble running the method in the action attribute.  It doesn't seem to ever want to run.  Code sample below. I've used both "onsubmit" and "onchange" with no results.  If any rerender attribute is in there, it just calls the getter and I don't see any debug "testing" line.
<apex:page standardController="Opportunity" extensions="conExt" tabStyle="Opportunity" title="Opportunity: {!opportunity.name}">
    <apex:pageMessages />
       <chatter:feedWithFollowers entityId="{!opportunity.id}"/>
       <apex:form >
        <apex:pageBlock mode="mainDetail" id="theBlock">
            <apex:pageBlockSection showHeader="true" columns="2" collapsible="true">
                <apex:outputField value="{!theObject.text__c}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
        <apex:detail subject="{!opportunity.id}" relatedList="true" title="true" inlineEdit="true">
             <apex:actionSupport event="onsubmit" action="{!sampleMethod}" />
        </apex:detail>
    </apex:form>
</apex:page>
 
public class conExt{

    //VARIABLES
    public sObject theObject;
    public Id objectId {get;set;}
      
    //CONSTRUCTOR
    public conExt(ApexPages.StandardController stdCon){
        //default values
        this.objectId = stdCon.getId();
        this.theObject = stdCon.getRecord();   
       
    }

    public sObject getTheObject(){
        sObject testObj = [Select Id, text__c from Opportunity where Id = : objectId];
        
        return testObj;
    }    

    public void sampleMethod(){
        system.debug('*****testing');
    }
}

Thank  you,

Klab
  • April 30, 2015
  • Like
  • 0

I'm looking for a way to dynamically bind a string's value, which contains a Field API Name, with an sObject instance variable and set the value of the sobject field to yet another string.  Here is what I mean.

 

Here is what I can do.

 

My_Custom_Object__c cRecord = new My_Custom_Object__c (); 
cRecord.field1__c = 'field value'; 
String X = cRecord.field1__c;

 So String X would be equal to 'field value'.

 

Here is what I'd like to do.

 

My_Custom_Object__c cRecord = new My_Custom_Object__c ();
cRecord.field1__c = 'field value';
String Y = 'field1__c';
String X = cRecord.Y;

 

Clearly the error I get is that the Y field does not exist, so is there a special notation for doing this?  I've seen similar things done in dynamic SOQL, but not in APEX.  http://salesforce.stackexchange.com/questions/8408/bind-variable-with-dotted-name-not-working-in-dynamic-soql.
 
Any ideas?  Is there some method like, value(Y),  for cRecord.value(Y)? Just some method that passes on the value of the string instead of the dot notation looking for a field named 'Y'?
 
Thank you!
 
  • October 10, 2013
  • Like
  • 0

Hi VF experts,

 

I've been running into an issue with creating a VF page using Tab Panel, and each Tab within the Tab Panel holds a List View of a Custom Object.  I am not using Enchanced Lists because there is a limit on how many of those can be displayed on a VF page, so I have resorted to the basic List View.

 

My problem is whenever a user clicks on a sort funciton, selects a view from the dropdown, or clicks to view more records, the Tab Focus of the Tab Panel is set back to the default tab.  The user then has to click back to the tab he/she was on to see the result of the sort function, new selected view or different records.  So it remembers what the user did on the individual tab itself, but the Tab focus always goes to the default one.  

 

I've search high and low for a solution to this. Here are a few I found that don't seem to work.

 

http://boards.developerforce.com/t5/Visualforce-Development/ListView-inside-tabPanel-refreshing-whole-page/m-p/639571#M65884

 

http://boards.developerforce.com/t5/Visualforce-Development/Setting-selectedTab-via-CurrentPage-parameters/td-p/118568

 

http://boards.developerforce.com/t5/Visualforce-Development/tabPanel-selectedTab-issue/m-p/74299

 

Here is my controller code

 

public with sharing class TestsTabController {
    
    String selectedTabName = null;  //variable from the VF page
    Id currentUserId;
    Boolean boolSelectedTabSet = false;
    String defaultSelectedTabName = 'object2';
    String currentTabName = null; //variable to hold the value of the selectedTabName;
    
    public TestsTabController(){  //constructor
    	currentUserId = UserInfo.getUserId();    // userID for debug purposes
    }
    
    private void computeSelectedTabName(){
        If (this.boolSelectedTabSet == true){  //if setSelectedTabName function has been invoked and bool set to true
            this.selectedTabName =  this.currentTabName; // set selectedTabName to the value of currentTabName
        } else { //if set function has not been invoked, use defaultTabName value
            this.selectedTabName = this.defaultSelectedTabName;	// set selectedTabName to default
	}
    }
    
    public String getSelectedTabName() {
            computeSelectedTabName();  // run method to see if value of selectedTabName should be set to default or to the displayed tab in the UI
            return this.selectedTabName; 
    }
      
    public void setSelectedTabName(String tabName) {
	 this.currentTabName = tabName;  // set the selectedTabName to the currentTabName
         this.boolSelectedTabSet = true; //set the bool to true
    }
}

 

 

Here is my code for the VF page

 

<apex:page showheader="true" id="thePage"  tabstyle="Tests__tab" controller="TestsTabController">
    <style>
    .activeTab {background-color: #236FBD; color:white; background-image:none}
    .inactiveTab { background-color: lightgrey; color:black; background-image:none}
    </style>
       <apex:tabPanel switchType="ajax" value="{!selectedTabName}" id="tabPanel" tabClass="activeTab" inactiveTabClass="inactiveTab">            
        <apex:tab label="object1" name="object1" id="tabOne">
            <apex:ListViews type="object1__c" /></apex:tab>        
        <apex:tab label="object2" name="object2" id="tabTwo">
            <apex:ListViews type="object2__c" /></apex:tab>
        <apex:tab label="object3" name="object3" id="tabThree">
            <apex:ListViews type="object3__c"  /></apex:tab>
        <apex:tab label="object4" name="object4" id="tabFour">
            <apex:ListViews type="object4__c" /></apex:tab>
        <apex:tab label="object5" name="object5" id="tabFive">
            <apex:ListViews type="object5__c" /></apex:tab>
    </apex:tabPanel>
</apex:page>

 

Any ideas on what is wrong or how this can be accomplished?

 

Thank you,

  • July 02, 2013
  • Like
  • 0

Hey all,

 

I'm looking for some direction on syntax that will grab the Id of a record that was updated in the UI for further processing in my custom classes. The application is to recreate a roll-up summary field scenario, which will be used as a building block for further complex calculations that are simiar to how roll-up summary fields work but are more complex that what declaritive programming offers.

 

Let's say I have a Parent-Child relationship and want to keep track of an average of the children and store it on the parent object. Instead of using the RSF to compute the average, I would like to use a Trigger to grab the ID of the child record that was just updated in the UI, pass it to a custom Class where the it is used in a query to find the child recrords with the same parent record. The calculation will then take place and the parent record will be updated with the new value.

 

I had no problem doing this using execute anonymous when I hard-code the child record, but I need to have a way to dynamically grab that child record Id to kick off the query and calculations in the class.

 

Child_Object__c myChild = [SELECT c.Parent__c from Child_Object__c c WHERE 'a02F00200055uTU' =:c.Id]

 

Is something like the below allowed in a Trigger to grab the Id? I'm focused on the WHERE clause. Does that ensure that myChild is set to the record that was just updated in the UI?

 

Child_Object__c myChild = [SELECT c.Parent__c from Child_Object__c c WHERE Id =:c.Id]

 

Once I know I have the Id, I can pass that to the class and run the right calculations.  Maybe the Trigger is not the way to do this, but I can't think of another way to call the class. Here is someone else trying to do it as well, http://boards.developerforce.com/t5/Apex-Code-Development/Apex-Rollup-Summary-Trigger-more-than-one-Sum-in-a-map/m-p/357933/highlight/true#M63499.

 

Thank you

  • March 14, 2013
  • Like
  • 0
Has anyone ever used actionSupport with the <apex:detail> tag when inlineEdit is set to true? I'm having trouble running the method in the action attribute.  It doesn't seem to ever want to run.  Code sample below. I've used both "onsubmit" and "onchange" with no results.  If any rerender attribute is in there, it just calls the getter and I don't see any debug "testing" line.
<apex:page standardController="Opportunity" extensions="conExt" tabStyle="Opportunity" title="Opportunity: {!opportunity.name}">
    <apex:pageMessages />
       <chatter:feedWithFollowers entityId="{!opportunity.id}"/>
       <apex:form >
        <apex:pageBlock mode="mainDetail" id="theBlock">
            <apex:pageBlockSection showHeader="true" columns="2" collapsible="true">
                <apex:outputField value="{!theObject.text__c}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
        <apex:detail subject="{!opportunity.id}" relatedList="true" title="true" inlineEdit="true">
             <apex:actionSupport event="onsubmit" action="{!sampleMethod}" />
        </apex:detail>
    </apex:form>
</apex:page>
 
public class conExt{

    //VARIABLES
    public sObject theObject;
    public Id objectId {get;set;}
      
    //CONSTRUCTOR
    public conExt(ApexPages.StandardController stdCon){
        //default values
        this.objectId = stdCon.getId();
        this.theObject = stdCon.getRecord();   
       
    }

    public sObject getTheObject(){
        sObject testObj = [Select Id, text__c from Opportunity where Id = : objectId];
        
        return testObj;
    }    

    public void sampleMethod(){
        system.debug('*****testing');
    }
}

Thank  you,

Klab
  • April 30, 2015
  • Like
  • 0

I'm looking for a way to dynamically bind a string's value, which contains a Field API Name, with an sObject instance variable and set the value of the sobject field to yet another string.  Here is what I mean.

 

Here is what I can do.

 

My_Custom_Object__c cRecord = new My_Custom_Object__c (); 
cRecord.field1__c = 'field value'; 
String X = cRecord.field1__c;

 So String X would be equal to 'field value'.

 

Here is what I'd like to do.

 

My_Custom_Object__c cRecord = new My_Custom_Object__c ();
cRecord.field1__c = 'field value';
String Y = 'field1__c';
String X = cRecord.Y;

 

Clearly the error I get is that the Y field does not exist, so is there a special notation for doing this?  I've seen similar things done in dynamic SOQL, but not in APEX.  http://salesforce.stackexchange.com/questions/8408/bind-variable-with-dotted-name-not-working-in-dynamic-soql.
 
Any ideas?  Is there some method like, value(Y),  for cRecord.value(Y)? Just some method that passes on the value of the string instead of the dot notation looking for a field named 'Y'?
 
Thank you!
 
  • October 10, 2013
  • Like
  • 0

Hi VF experts,

 

I've been running into an issue with creating a VF page using Tab Panel, and each Tab within the Tab Panel holds a List View of a Custom Object.  I am not using Enchanced Lists because there is a limit on how many of those can be displayed on a VF page, so I have resorted to the basic List View.

 

My problem is whenever a user clicks on a sort funciton, selects a view from the dropdown, or clicks to view more records, the Tab Focus of the Tab Panel is set back to the default tab.  The user then has to click back to the tab he/she was on to see the result of the sort function, new selected view or different records.  So it remembers what the user did on the individual tab itself, but the Tab focus always goes to the default one.  

 

I've search high and low for a solution to this. Here are a few I found that don't seem to work.

 

http://boards.developerforce.com/t5/Visualforce-Development/ListView-inside-tabPanel-refreshing-whole-page/m-p/639571#M65884

 

http://boards.developerforce.com/t5/Visualforce-Development/Setting-selectedTab-via-CurrentPage-parameters/td-p/118568

 

http://boards.developerforce.com/t5/Visualforce-Development/tabPanel-selectedTab-issue/m-p/74299

 

Here is my controller code

 

public with sharing class TestsTabController {
    
    String selectedTabName = null;  //variable from the VF page
    Id currentUserId;
    Boolean boolSelectedTabSet = false;
    String defaultSelectedTabName = 'object2';
    String currentTabName = null; //variable to hold the value of the selectedTabName;
    
    public TestsTabController(){  //constructor
    	currentUserId = UserInfo.getUserId();    // userID for debug purposes
    }
    
    private void computeSelectedTabName(){
        If (this.boolSelectedTabSet == true){  //if setSelectedTabName function has been invoked and bool set to true
            this.selectedTabName =  this.currentTabName; // set selectedTabName to the value of currentTabName
        } else { //if set function has not been invoked, use defaultTabName value
            this.selectedTabName = this.defaultSelectedTabName;	// set selectedTabName to default
	}
    }
    
    public String getSelectedTabName() {
            computeSelectedTabName();  // run method to see if value of selectedTabName should be set to default or to the displayed tab in the UI
            return this.selectedTabName; 
    }
      
    public void setSelectedTabName(String tabName) {
	 this.currentTabName = tabName;  // set the selectedTabName to the currentTabName
         this.boolSelectedTabSet = true; //set the bool to true
    }
}

 

 

Here is my code for the VF page

 

<apex:page showheader="true" id="thePage"  tabstyle="Tests__tab" controller="TestsTabController">
    <style>
    .activeTab {background-color: #236FBD; color:white; background-image:none}
    .inactiveTab { background-color: lightgrey; color:black; background-image:none}
    </style>
       <apex:tabPanel switchType="ajax" value="{!selectedTabName}" id="tabPanel" tabClass="activeTab" inactiveTabClass="inactiveTab">            
        <apex:tab label="object1" name="object1" id="tabOne">
            <apex:ListViews type="object1__c" /></apex:tab>        
        <apex:tab label="object2" name="object2" id="tabTwo">
            <apex:ListViews type="object2__c" /></apex:tab>
        <apex:tab label="object3" name="object3" id="tabThree">
            <apex:ListViews type="object3__c"  /></apex:tab>
        <apex:tab label="object4" name="object4" id="tabFour">
            <apex:ListViews type="object4__c" /></apex:tab>
        <apex:tab label="object5" name="object5" id="tabFive">
            <apex:ListViews type="object5__c" /></apex:tab>
    </apex:tabPanel>
</apex:page>

 

Any ideas on what is wrong or how this can be accomplished?

 

Thank you,

  • July 02, 2013
  • Like
  • 0

Hey all,

 

I'm looking for some direction on syntax that will grab the Id of a record that was updated in the UI for further processing in my custom classes. The application is to recreate a roll-up summary field scenario, which will be used as a building block for further complex calculations that are simiar to how roll-up summary fields work but are more complex that what declaritive programming offers.

 

Let's say I have a Parent-Child relationship and want to keep track of an average of the children and store it on the parent object. Instead of using the RSF to compute the average, I would like to use a Trigger to grab the ID of the child record that was just updated in the UI, pass it to a custom Class where the it is used in a query to find the child recrords with the same parent record. The calculation will then take place and the parent record will be updated with the new value.

 

I had no problem doing this using execute anonymous when I hard-code the child record, but I need to have a way to dynamically grab that child record Id to kick off the query and calculations in the class.

 

Child_Object__c myChild = [SELECT c.Parent__c from Child_Object__c c WHERE 'a02F00200055uTU' =:c.Id]

 

Is something like the below allowed in a Trigger to grab the Id? I'm focused on the WHERE clause. Does that ensure that myChild is set to the record that was just updated in the UI?

 

Child_Object__c myChild = [SELECT c.Parent__c from Child_Object__c c WHERE Id =:c.Id]

 

Once I know I have the Id, I can pass that to the class and run the right calculations.  Maybe the Trigger is not the way to do this, but I can't think of another way to call the class. Here is someone else trying to do it as well, http://boards.developerforce.com/t5/Apex-Code-Development/Apex-Rollup-Summary-Trigger-more-than-one-Sum-in-a-map/m-p/357933/highlight/true#M63499.

 

Thank you

  • March 14, 2013
  • Like
  • 0
Hello everyone

I'm having problems with a listview inside a tab panel. I've created two tabs inside the panel, the first one contains a form and the second one a listview. The problem is that once I enter to the second tab (the one with the list view) and click for example a letter in the list view to see only records that start with that letter, the whole VF page is refreshed and I get back to the first tab, the second tab now contains only the records that start with the letter I selected, however since the page was refreshed I landed in the default tab, which is the first one.

I've already tried passing the selected tab name to the controller and setting a String with this name in order to use it in the value property of the tabpanel component:

Code:
<script>
function updateTab(tabname){
      switchTab(tabname);
}
 </script>

 <apex:form >
 <apex:actionFunction name="switchTab" action="{!switchTab}" immediate="true">
  <apex:param name="tabvalue" value="" />
 </apex:actionFunction>
 </apex:form>

     <apex:tabPanel id="tabcontainer" value="{!selectedTab}">

<apex:tab id="tab_1" name="tab_1" ontabenter="updateTab('tab_1');"/>

<apex:tab id="tab_2" name="tab_2" ontabenter="updateTab('tab_2');">
  <apex:listViews type="theObject__c"
</apex:tab>

And the controller:

public String selectedTab{get;set;}

    public void switchTab(){
     
         selectedTab = System.currentPageReference().getParameters().get('tabvalue');    
     
    }

 Any help will be very appreciated, thank you very much.



Message Edited by jonathan rico on 09-01-2008 12:34 PM