You need to sign in to do that
Don't have an account?

I need to write a trigger to update a field(Field A) on record(Object A) After Insert and After Update with a value from a field(Field B) on its Parent(Object B). The relationship is master detail
I am trying to write a trigger to update a field(Field_A) on record(Object_A) when Object_A is created or updated with the value from a field(Field_B) on its Parent(Object_B). The relationship is master detail. Object_B is the master.
I want to make sure the code is bulkified. I am having a bit of trouble figuring it out. I know it should be simple.
Any ideas on how to do this best?
I want to make sure the code is bulkified. I am having a bit of trouble figuring it out. I know it should be simple.
Any ideas on how to do this best?
You can easily achieve this via Workflow, no need to write triggers.
Workfrow rule on Object A,
Workflow field update on Field A set equal to ObjectB.FieldB
Thx
Whenever billingstreet is updated in accounts related contacts mailingstreet will be updated.
If I understand your requirment correctly, then you are trying to update your child record field value with parent record field value, right?
If this is the case, then instead of writing the trigger and wasting your time, just create the formula field on child object(Object_A) as below:
Field_A = Object_B__r.Field_B
Here, wherever you link the child record with it's parent record, Field_A will automatically updated with the value of Field_B from it's parent object.
Thanks,
Prashant
Do you know how I can do this?