-2

I want to update custom field on custom object in Salesforce record.I am not able to update field. enter image description here

So basically I want is when value changes from picklist , value should be updated in respective record of salesforce as well.

2
  • Are you using <apex:inputField> tag to display picklist field? Is there only one record displayed or list of records displayed?
    – user36778
    Commented Feb 26, 2018 at 11:32
  • @user36778 Yes I uses <apex:inputField> tag to display field. There is list of records to display. Commented Feb 26, 2018 at 12:37

1 Answer 1

2

You can use "Onchange" attribute of the tag (I assume you are using apex:inputfield tag).

Basically, you can create an apex method in your apex controller to update the field value. Also, create an action function on VF page. This action function will call Apex Method that you created.

Now, in "Onchange" event of the picklist field, call this action function. So, called action function will make a call to Apex Method and this apex method will make a DML statement to save picklist value.

2
  • Can you elaborate your answer in detail? Specially on "action function on VF page"... Commented Feb 26, 2018 at 13:10
  • The Visualforce Developer Guide has details on the <apex:actionFunction> component.
    – David Reed
    Commented Feb 26, 2018 at 15:12

Not the answer you're looking for? Browse other questions tagged .