• vcv
  • NEWBIE
  • 20 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 4
    Replies
Hi, I have the classic issue. There are three custom objects (Employees, Productivity, Salaries) which have lookup relationships to each other. I'm using the standard controller "Employees__c" and want to make a form where I access the field Level__c from Productivity__c and Grading__c from Salaries__c.

What's wrong with my __r usage? :)
 
<apex:page standardController="Employees__c">
    <apex:form id="formEmp" >
        
        <apex:pageBlock title="Link employees">
            
            <apex:pageBlockSection columns="1">

            <apex:inputField value="{!Employees__c.FirstName__c}">
                </apex:inputField>

                  <apex:inputField value="{!Employees__c.Productivity__r.Level__c}">
                </apex:inputField>

                         <apex:inputField value="{!Employees__c.Productivity__r.Level__c}">
                </apex:inputField>


                         <apex:inputField value="{!Employees__c.Salaries__r.Grading__c}">
                </apex:inputField>

            </apex:pageBlockSection>

            <!-- buttons -->
            <apex:pageBlockButtons >
                <apex:commandButton id="Save" action="{!Save}" value="Save"/>
                <apex:commandButton id="Cancel" action="{!Cancel}" value="Cancel"/>
            </apex:pageBlockButtons>
            
        </apex:pageBlock>

    </apex:form>
</apex:page>

 
  • July 30, 2018
  • Like
  • 0

I have three related objects and I wanto to populat picklists with records from different fields.


Example: Object1__c.Name__c (text field) Object2__c.AvailableAppointments__c (date), Object3__c.AppointmentDuration (minutes).


The following code works fine, however it only displays the picklist for Object1__c.Name__c. How can I add two additional picklists with values from Object2 and Object3 fields?

VF:

<apex:page controller="sampleCon">
    <apex:form >
        <apex:selectList value="{!strSelected}" multiselect="false" size="1">
            <apex:selectOptions value="{!options}"/>
        </apex:selectList>
    </apex:form>
</apex:page>
Controller:
public class sampleCon {

 public String strSelected  {get;set;}
 public List<SelectOption> options {get;set;}

 public sampleCon() {
    strSelected = '';
    options = new List<SelectOption>();

    for(Object1__c obj :[SELECT Name FROM Object1__c]) 
    {
        options.add(new SelectOption(obj.Id,obj.Name));
    }

 }
}

 
  • July 28, 2018
  • Like
  • 0
Hi,

I have a beginner's problem:

I have a custom object (Candidates) with a VF page that overrides the standard form. Underneath there should be a list of records already submitted through the form. My code displays the form correctly, yet the list shows up empty. If i save a form entry, it appears in the list but disappears on refresh.  Is it possible to fix this issue exclusively in VF?

Here is the code:
<apex:page standardController="Candidates__c">
    <apex:form id="theForm">

    <apex:pageBlock title="Enter candidate">
            <apex:pageBlockSection columns="2">
                <apex:inputfield value="{!Candidate__c.FirstName__c}"/>
                <apex:inputfield value="{!Candidate__c.LastName__c}"/>                
            </apex:pageBlockSection>
     </apex:pageBlock>
           
<apex:pageBlock title="List of Candidates">
   <apex:pageBlockTable value="{!Candidates__c}" var="candidates">
      <apex:column value="{!candidates.FirstName}"/>
      <apex:column value="{!candidates.LastName}"/>
   </apex:pageBlockTable>
</apex:pageBlock>

        </apex:form>
    </apex:page>

 
  • July 25, 2018
  • Like
  • 0
Hi, I have the classic issue. There are three custom objects (Employees, Productivity, Salaries) which have lookup relationships to each other. I'm using the standard controller "Employees__c" and want to make a form where I access the field Level__c from Productivity__c and Grading__c from Salaries__c.

What's wrong with my __r usage? :)
 
<apex:page standardController="Employees__c">
    <apex:form id="formEmp" >
        
        <apex:pageBlock title="Link employees">
            
            <apex:pageBlockSection columns="1">

            <apex:inputField value="{!Employees__c.FirstName__c}">
                </apex:inputField>

                  <apex:inputField value="{!Employees__c.Productivity__r.Level__c}">
                </apex:inputField>

                         <apex:inputField value="{!Employees__c.Productivity__r.Level__c}">
                </apex:inputField>


                         <apex:inputField value="{!Employees__c.Salaries__r.Grading__c}">
                </apex:inputField>

            </apex:pageBlockSection>

            <!-- buttons -->
            <apex:pageBlockButtons >
                <apex:commandButton id="Save" action="{!Save}" value="Save"/>
                <apex:commandButton id="Cancel" action="{!Cancel}" value="Cancel"/>
            </apex:pageBlockButtons>
            
        </apex:pageBlock>

    </apex:form>
</apex:page>

 
  • July 30, 2018
  • Like
  • 0

I have three related objects and I wanto to populat picklists with records from different fields.


Example: Object1__c.Name__c (text field) Object2__c.AvailableAppointments__c (date), Object3__c.AppointmentDuration (minutes).


The following code works fine, however it only displays the picklist for Object1__c.Name__c. How can I add two additional picklists with values from Object2 and Object3 fields?

VF:

<apex:page controller="sampleCon">
    <apex:form >
        <apex:selectList value="{!strSelected}" multiselect="false" size="1">
            <apex:selectOptions value="{!options}"/>
        </apex:selectList>
    </apex:form>
</apex:page>
Controller:
public class sampleCon {

 public String strSelected  {get;set;}
 public List<SelectOption> options {get;set;}

 public sampleCon() {
    strSelected = '';
    options = new List<SelectOption>();

    for(Object1__c obj :[SELECT Name FROM Object1__c]) 
    {
        options.add(new SelectOption(obj.Id,obj.Name));
    }

 }
}

 
  • July 28, 2018
  • Like
  • 0
Hi,

I have a beginner's problem:

I have a custom object (Candidates) with a VF page that overrides the standard form. Underneath there should be a list of records already submitted through the form. My code displays the form correctly, yet the list shows up empty. If i save a form entry, it appears in the list but disappears on refresh.  Is it possible to fix this issue exclusively in VF?

Here is the code:
<apex:page standardController="Candidates__c">
    <apex:form id="theForm">

    <apex:pageBlock title="Enter candidate">
            <apex:pageBlockSection columns="2">
                <apex:inputfield value="{!Candidate__c.FirstName__c}"/>
                <apex:inputfield value="{!Candidate__c.LastName__c}"/>                
            </apex:pageBlockSection>
     </apex:pageBlock>
           
<apex:pageBlock title="List of Candidates">
   <apex:pageBlockTable value="{!Candidates__c}" var="candidates">
      <apex:column value="{!candidates.FirstName}"/>
      <apex:column value="{!candidates.LastName}"/>
   </apex:pageBlockTable>
</apex:pageBlock>

        </apex:form>
    </apex:page>

 
  • July 25, 2018
  • Like
  • 0