You need to sign in to do that
Don't have an account?
Ritika Singh
How to update field value for all existing records of an object ?
There's an custom object "Student" and
Field 1 : Subject
Field 2 : Branch
Current Scenario - Subject = Maths, Social, English, Arts
Branch(Multi picklist) - Science , Humanities, Commerce
Requirement :
Given : Subject - Maths & Branch - Humanities
TODO : For all picklist field with value Branch = Humanities,
Change Field value of Subject from Maths to English for all existing records in object.
What is the best possible way to achieve this by configuration ?
Field 1 : Subject
Field 2 : Branch
Current Scenario - Subject = Maths, Social, English, Arts
Branch(Multi picklist) - Science , Humanities, Commerce
Requirement :
Given : Subject - Maths & Branch - Humanities
TODO : For all picklist field with value Branch = Humanities,
Change Field value of Subject from Maths to English for all existing records in object.
What is the best possible way to achieve this by configuration ?
You can achieve this by using the process builder but the field gets updated whenever we edit/create the record only.In order to update all the existing record you would need to edit and save all the record which need manual effort.
So,I would suggest you to go with the batch class to achieve the same.
Kindly mark it as best answer if it helps so that it can help others in the future.
Warm Regards,
Shirisha Pathuri
All Answers
Greetings!
You can go with the batch apex to achieve this since you are trying to update all existing records based on the value of Brach field.
Reference:https://www.forcetalks.com/salesforce-topic/writing-a-batch-apex-to-update-field/
Kindly mark it as best answer if it helps so that it can help others in the future.
Warm Regards,
Shirisha Pathuri
Thanks for quick response ! Can we achieve the above scenario BY using any configuration technique in salesforce inspite customizing using batch class ?
You can achieve this by using the process builder but the field gets updated whenever we edit/create the record only.In order to update all the existing record you would need to edit and save all the record which need manual effort.
So,I would suggest you to go with the batch class to achieve the same.
Kindly mark it as best answer if it helps so that it can help others in the future.
Warm Regards,
Shirisha Pathuri
One way you can update all records is by using a schedule-triggered flow. This is usually a better option if you don't have a large amount of records you want to update.
Set the conditions as narrow as you can.
For your scenario, you can set the conditions
Object: Student
Conditions: Branch = Humanities
You must set the time in the future from when you activate the flow
Update Element = update subject to English
Hope this helps!