Skip to main content
John Neff (Ring2Media) a posé une question dans #Apex
Hello, 

I'd like to put an inputText field and corresponding button on one of my VF pages, so that the user can input a number in the box and a custom field on the corresponding record will be updated with that number.  However, I can't understand how to map the inputText field on the page to the custom field.  Is there anyone who would be willing to show the markup of how they accomplished this? 

I basically want to add something like: 

public PageReference save() {

opty.probability = 'INPUTTEXTFIELD';

update myAccount;

return null;

to my controller, which is below.  Can anyone help??

Thanks an advance!

Controller: 

 

public class R2MPipeLineController{

public List<Opportunity> listOfLive {get; set;}

public List<Opportunity> listOfViability {get; set;}

public List<Opportunity> listOfLaunchPad {get; set;}

public List<Opportunity> listOfContractSent {get; set;}

public List<Opportunity> listOfQualified {get; set;}

public Opportunity Live {get; set;}

public Opportunity Viability {get; set;}

public Opportunity LaunchPad {get; set;}

public Opportunity ContractSent {get; set;}

public Opportunity Qualified {get; set;}

public R2MPipeLineController() {

listofLive = [Select id, name, CreatedDate, Company_Name__c, Vertical__c, Weeks_Live__c, Days_Since_Last_Modified__c, Contract_SENT__c, NextStep, LeadSource, Probability, Spend_Last_Week__c, Spend_Last_30_Days__c, Owner_Name__c, Revenue_All_Time__c from Opportunity WHERE StageName = 'Live' ORDER BY Weeks_Live__c DESC];

listOfViability = [Select id, name, CreatedDate, Company_Name__c, Vertical__c, Weeks_Live__c, Days_Since_Last_Modified__c, Contract_SENT__c, NextStep, LeadSource, Probability, Spend_Last_Week__c, Spend_Last_30_Days__c, Owner_Name__c, Revenue_All_Time__c from Opportunity WHERE StageName = 'Viability' ORDER BY Days_Since_Last_Modified__c DESC];

listOfLaunchPad = [Select id, name, CreatedDate, Company_Name__c, Vertical__c, Weeks_Live__c, Days_Since_Last_Modified__c, Contract_SENT__c, NextStep, LeadSource, Probability, Spend_Last_Week__c, Spend_Last_30_Days__c, Owner_Name__c, Revenue_All_Time__c from Opportunity WHERE StageName = 'Launch Pad' ORDER BY Days_Since_Last_Modified__c DESC];

listOfContractSent = [Select id, name, CreatedDate, Company_Name__c, Vertical__c, Weeks_Live__c, Days_Since_Last_Modified__c, Contract_SENT__c, NextStep, LeadSource, Probability, Spend_Last_Week__c, Spend_Last_30_Days__c, Owner_Name__c, Revenue_All_Time__c, Contract_Age__c from Opportunity WHERE StageName = 'Contract Sent' ORDER BY Contract_Age__c ASC];

listOfQualified = [Select id, name, CreatedDate, Company_Name__c, Vertical__c, Weeks_Live__c, Days_Since_Last_Modified__c, Contract_SENT__c, NextStep, LeadSource, Probability, Spend_Last_Week__c, Spend_Last_30_Days__c, Owner_Name__c, Revenue_All_Time__c from Opportunity WHERE StageName = 'Qualified' ORDER BY Probability DESC];

}

}

 
5 réponses
  1. 19 avr. 2016, 13:52
    Thank you, I added:

     

    public PageReference saveCS(){

    UPDATE ContractSent;

    return null;

    }

    to my controller and 

     

    <apex:commandButton id="update" action="{!saveCS}" value="Update Opptys"/>

    to my VF page, however when I test the commandButton I get this error: 

     

    Attempt to de-reference a null object

    Error is in expression '{!saveCS}' in component <apex:commandButton> in page r2m_contracts_out: Class.R2MPipeLineController.saveCS: line 15, column 1

    An unexpected error has occurred. Your development organization has been notified.

    I think I'm getting close here, but I can't seem to get this across the line.

    What am I missing?
0/9000