You need to sign in to do that
Don't have an account?
lainchbury
Using an Apex trigger to update the value of a picklist field.
Hello
I'm trying to use an apex trigger to update the value of a picklist field on a related object. The trigger will execute when a custom object is inserted and then retrive a list of all the Tasks associated with the custom object.
I then want to change the 'Status' field (which is a picklist field) on the tasks.
Does anyone have any sample code for changing picklist field values in Apex?
Thank you.
a picklist field can be updated the same way as a plain text field.
after you queried for the tasks, create a loop to go through them.
in the loop just do
task.Status = 'new status' ;
and after going through the loop, update the set of tasks.
Hope this helps,
Guy
All Answers
a picklist field can be updated the same way as a plain text field.
after you queried for the tasks, create a loop to go through them.
in the loop just do
task.Status = 'new status' ;
and after going through the loop, update the set of tasks.
Hope this helps,
Guy
Here is your trigger
I hope will work for you.
I have a Status Field contains "AAAAA", "BBBBB", "CCCCC","DDDDD".
at this time Status field(Picklist Value)is ""BBBBB"
After 10 Days I want to change that "BBBBB" to "CCCCC" automatically
How can i update by using SFDC
No code needed for that. I'd suggest time-based workflow, combined with a field update. See the regular Salesforce documentation or the help function.