• Emily soares
  • NEWBIE
  • 9 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies
HI, i am practicing for Salesforce developer 1.  I came across this question and the answer offered didnt make any sense to me.

The operation manager at a construction company uses a custom object called Machinery to manage the usage and maintenance of its cranes and other machinery. The manager wants to be able to assign machinery to different construction jobs, and track the dates and cost associated with each job. More than one piece of machinery can be assigned to one construction job. What should a developer do to meet these requirements?
  1. Create a lookup field on the machinery object to the construction job object
  2. Create a junction object with Master-Detail Relationship to both the machinery object and the construction job object.
  3. Create a lookup field on the construction job object to the machinery object
  4. Create a Master-Detail lookup field on the machinery object to the construction job object

The answer provided was n.3.  I would have gone with n.2.

Would you be able to help me with this and explain the answer to this by any chance

Many thanks
 
Hi,

I have a page listing all applications per job. the application object has a picklist field called ApplicationStatus__c.
We need to be able to select an applicationStatus for each of the applications and save it.
For some reason the selected value from the picklist is not being passed back to the controller.  and the value returned is the initial one ('New').  

public with sharing class JobCandidateController {

    public List <application__c> ListOfApplication {get; set;}
    public List<WrapperApplications> ApplicationWrappersList {get;set;}
   public List <WrapperApplications> ListOfApplicationWrapper {get; set;}

    
    
    private final candidate__c Cand;
    
    public string selectedValue { get; set; }
     
   
    
   
    public JobCandidateController() {       
        
       
       ListOfApplicationWrapper = new List<WrapperApplications>();
       ListOfApplicationWrapper = GetCandidateList();    
        
      
         system.debug ('******Selected VAlues are************ '+ ListOfApplicationWrapper);
       
             
        
    }

    public List <WrapperApplications> GetCandidateList() {
    
   
       
    ApplicationWrappersList = new List <WrapperApplications>();
      
      
      ListOfApplication  = [select candidate__r.Firstname__c,candidate__r.Surname__c, ApplicationStatus__c from application__c  where jobs__c
                   = :ApexPages.currentPage().getParameters().get('id')];
                   
           for (application__c appl : ListOfApplication)
           
           {
           ApplicationWrappersList.add(new WrapperApplications(appl, getOptions() ,'New'));
           
           }
               
                   
              return ApplicationWrappersList;
    }
    
    
   

public List <selectoption> getOptions()
{

    
    Schema.DescribeFieldResult statusFieldDescription = Application__c.ApplicationStatus__c.getDescribe();  
        
   
    
    List<SelectOption> options = new List<SelectOption>();

    
    for (Schema.Picklistentry picklistEntry : statusFieldDescription.getPicklistValues())
    {
        options.add(new SelectOption(pickListEntry.getValue(),pickListEntry.getLabel()));
        system.debug ('******PickList VAlues are************ '+  pickListEntry.getValue());
        
    }
    
    return options;
}
      
      
      //how element are married and displayed on page
      
    public class WrapperApplications {

        public application__c app {get; set;}

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

        public String selectedValue {get; set;}

      

    public WrapperApplications( application__c c,List < SelectOption > options, String selectedValue) {

     app=c;

     this.options = options;

     this.selectedValue = selectedValue;

     }
   

  }
  
      
      

public PageReference saveCase(){

    List <application__c> ListOfApplicationToUpdate = new List <application__c>();
   
    for(WrapperApplications ca :ListOfApplicationWrapper)
    {
 
    system.debug ('******PickList VAlues are************ '+ ca.selectedValue);
   
    
       ca.app.ApplicationStatus__c = ca.selectedValue;
        //ca.ApplicationStatus__c = selectValue ;
        ListOfApplicationToUpdate.add(ca.app);      

    }
    
    update ListOfApplicationToUpdate;
    return null;
 
}}


<apex:page controller="JobCandidateController"> <apex:pageBlock id="thePageBlock" > <apex:pageBlockTable value="{! ListOfApplicationWrapper}" var="recordCase"> <apex:column > <apex:outputText value="{! recordCase.app.candidate__r.Surname__c }"/> <apex:facet name="header">Candidate FirstName </apex:facet> </apex:column> <apex:column > <apex:outputText value="{! recordCase.app.candidate__r.Firstname__c }"/> <apex:facet name="header">Candidate Surname</apex:facet> </apex:column> <apex:column > <apex:outputText value="{! recordCase.app.ApplicationStatus__c }"/> <apex:facet name="header">Application Status</apex:facet> </apex:column> <apex:column > <apex:form > <apex:selectList size="1" required="true" multiselect="false" label="Type" value="{!recordCase.selectedValue}" onchange="changeStatus()" > <apex:selectOptions value="{!recordCase.options}"/> </apex:selectList> </apex:form> </apex:column> </apex:pageBlockTable> <apex:form > <apex:commandButton value="Save" action="{!saveCase}" /> </apex:form> </apex:pageBlock> </apex:page>
HI, i am practicing for Salesforce developer 1.  I came across this question and the answer offered didnt make any sense to me.

The operation manager at a construction company uses a custom object called Machinery to manage the usage and maintenance of its cranes and other machinery. The manager wants to be able to assign machinery to different construction jobs, and track the dates and cost associated with each job. More than one piece of machinery can be assigned to one construction job. What should a developer do to meet these requirements?
  1. Create a lookup field on the machinery object to the construction job object
  2. Create a junction object with Master-Detail Relationship to both the machinery object and the construction job object.
  3. Create a lookup field on the construction job object to the machinery object
  4. Create a Master-Detail lookup field on the machinery object to the construction job object

The answer provided was n.3.  I would have gone with n.2.

Would you be able to help me with this and explain the answer to this by any chance

Many thanks
 
Hi,

I have a page listing all applications per job. the application object has a picklist field called ApplicationStatus__c.
We need to be able to select an applicationStatus for each of the applications and save it.
For some reason the selected value from the picklist is not being passed back to the controller.  and the value returned is the initial one ('New').  

public with sharing class JobCandidateController {

    public List <application__c> ListOfApplication {get; set;}
    public List<WrapperApplications> ApplicationWrappersList {get;set;}
   public List <WrapperApplications> ListOfApplicationWrapper {get; set;}

    
    
    private final candidate__c Cand;
    
    public string selectedValue { get; set; }
     
   
    
   
    public JobCandidateController() {       
        
       
       ListOfApplicationWrapper = new List<WrapperApplications>();
       ListOfApplicationWrapper = GetCandidateList();    
        
      
         system.debug ('******Selected VAlues are************ '+ ListOfApplicationWrapper);
       
             
        
    }

    public List <WrapperApplications> GetCandidateList() {
    
   
       
    ApplicationWrappersList = new List <WrapperApplications>();
      
      
      ListOfApplication  = [select candidate__r.Firstname__c,candidate__r.Surname__c, ApplicationStatus__c from application__c  where jobs__c
                   = :ApexPages.currentPage().getParameters().get('id')];
                   
           for (application__c appl : ListOfApplication)
           
           {
           ApplicationWrappersList.add(new WrapperApplications(appl, getOptions() ,'New'));
           
           }
               
                   
              return ApplicationWrappersList;
    }
    
    
   

public List <selectoption> getOptions()
{

    
    Schema.DescribeFieldResult statusFieldDescription = Application__c.ApplicationStatus__c.getDescribe();  
        
   
    
    List<SelectOption> options = new List<SelectOption>();

    
    for (Schema.Picklistentry picklistEntry : statusFieldDescription.getPicklistValues())
    {
        options.add(new SelectOption(pickListEntry.getValue(),pickListEntry.getLabel()));
        system.debug ('******PickList VAlues are************ '+  pickListEntry.getValue());
        
    }
    
    return options;
}
      
      
      //how element are married and displayed on page
      
    public class WrapperApplications {

        public application__c app {get; set;}

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

        public String selectedValue {get; set;}

      

    public WrapperApplications( application__c c,List < SelectOption > options, String selectedValue) {

     app=c;

     this.options = options;

     this.selectedValue = selectedValue;

     }
   

  }
  
      
      

public PageReference saveCase(){

    List <application__c> ListOfApplicationToUpdate = new List <application__c>();
   
    for(WrapperApplications ca :ListOfApplicationWrapper)
    {
 
    system.debug ('******PickList VAlues are************ '+ ca.selectedValue);
   
    
       ca.app.ApplicationStatus__c = ca.selectedValue;
        //ca.ApplicationStatus__c = selectValue ;
        ListOfApplicationToUpdate.add(ca.app);      

    }
    
    update ListOfApplicationToUpdate;
    return null;
 
}}


<apex:page controller="JobCandidateController"> <apex:pageBlock id="thePageBlock" > <apex:pageBlockTable value="{! ListOfApplicationWrapper}" var="recordCase"> <apex:column > <apex:outputText value="{! recordCase.app.candidate__r.Surname__c }"/> <apex:facet name="header">Candidate FirstName </apex:facet> </apex:column> <apex:column > <apex:outputText value="{! recordCase.app.candidate__r.Firstname__c }"/> <apex:facet name="header">Candidate Surname</apex:facet> </apex:column> <apex:column > <apex:outputText value="{! recordCase.app.ApplicationStatus__c }"/> <apex:facet name="header">Application Status</apex:facet> </apex:column> <apex:column > <apex:form > <apex:selectList size="1" required="true" multiselect="false" label="Type" value="{!recordCase.selectedValue}" onchange="changeStatus()" > <apex:selectOptions value="{!recordCase.options}"/> </apex:selectList> </apex:form> </apex:column> </apex:pageBlockTable> <apex:form > <apex:commandButton value="Save" action="{!saveCase}" /> </apex:form> </apex:pageBlock> </apex:page>