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

populating child value from parent with help of trigger
Hello,
I have a currency field on my object with name Price__c i want to populate it from the field (ParentPrice__c ) of parent (Parent__c)
how can i achieve it in trigger,
thanks for suggestion
I have a currency field on my object with name Price__c i want to populate it from the field (ParentPrice__c ) of parent (Parent__c)
how can i achieve it in trigger,
thanks for suggestion
{
List<Price__c > child = new List<Price__c >();
List<Parent__c> parent = [select id,ParentPrice__c from Parent__c where id in: trigger.newmap.keyset()];
for(Parent__c con: parent)
{
con.currencyfield__c = con.ParentPrice__c ;
child.add(con);
}
update child;
}
All Answers
{
List<Price__c > child = new List<Price__c >();
List<Parent__c> parent = [select id,ParentPrice__c from Parent__c where id in: trigger.newmap.keyset()];
for(Parent__c con: parent)
{
con.currencyfield__c = con.ParentPrice__c ;
child.add(con);
}
update child;
}