+ Start a Discussion
RONURONU 

Update Custom field using vf page...!!

Hi all,

    i have one question to ask...!!!!!!!!!

There is a vf page which contains some records of account and in front of every record there is one picklist field(i created using <apex:selectlist>) which has 3 values red,blue,green...n there is a custom text field "priority" on account object...all i need is whenever i select any value in vf page so the same value should be inserted into the custom text field...and there is a save update button on vf page which do all this process...

 

BRIEF SUMMARY :

- select any value(blue,green,red) on vf page for any record

- after clicking save the same value should be inserted into the account record's custom field "priority"....

 

any help would be appreciated....thanks in advance....

Shiv ShankarShiv Shankar

You can achive it through Controller Class

 

befor inserting the record just use this value which you have specified in to 

<apex:selectList value="{!countries}"



suppose rec is reocrd which you are inserting from your class

rec.priority = countries ;
insert rec.

 

 

 

 

 

Adam HowarthAdam Howarth

Hey,

 

The easiest thing to do which wouldnt require much coding or any controller, would be to set up a trigger.

 

This means whenever an account is updated or created, the trigger will fire and you can update the field you want.

 

Trigger Info

 

trigger AccountChangedTrigger on Account (after insert, after update) {
    for (Account a : Trigger.new) {        
           a.priority__c = [selected field on the page]
        } 
}

 

Cheers,

Adam