function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jack InsJack Ins 

InPutFields and APEX Class Controller help needed.

First I need to state that for some reason this page for enetering a new message does not work properly for me. It is center aligned and no graphics. Which meens that I can not post my code but I can email it. OK so I have a VF Page that has InputFields and I have created a button that I need to have update the opportunity with the new values that have been entered. On click of the save button I am going to the apex class to run the save action. In this public call I list the opportunity and in a FOR I run a select query to find the correct record. Just need to reference the inputfield value from the VF page to update the opportunity. Any help would be greatly appreciated. Thanks Dwayne
Best Answer chosen by Admin (Salesforce Developers) 
Imran MohammedImran Mohammed

IF you are unable to reference the InputField value in the SOQL query directly, do this prior to SOQL query.

Assign the value of InputField to a variable with appropriate  data type.

Then in the SOQl query just use that variable.

for ex:

Date dt = Opportunity.CloseDate;

Now in SOQL

Opportunity[]  oppList = [select id,  ..,.., from Opportunity where CreatedDate >= :dt];

All Answers

Imran MohammedImran Mohammed

Is the InputField binded to the Opportunity field of the COntroller or is it referencing to some other object?

Jack InsJack Ins
I beleive it to be bound to the opp. " "
Imran MohammedImran Mohammed

IF you are unable to reference the InputField value in the SOQL query directly, do this prior to SOQL query.

Assign the value of InputField to a variable with appropriate  data type.

Then in the SOQl query just use that variable.

for ex:

Date dt = Opportunity.CloseDate;

Now in SOQL

Opportunity[]  oppList = [select id,  ..,.., from Opportunity where CreatedDate >= :dt];

This was selected as the best answer
Jack InsJack Ins
Thank yopu so much... It was easier than I thought. Used the following since I already had a binding to the record. update xopportunity;