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

Trigger to Pull a field value from One Child Record to Another Child Record
Hi There,
I have 3 objects.
1) Inventory
2) Agreement
3) Banking
Inventory is a lookup field on Agreement.
Agreement is a lookup field on Banking.
We have 2 types of Agreements linked to the same Inventory record.
1) Lease
2) PM
The banking record is automatically created on the Lease agreement when the Lease Agreement Stage = Signed.
The PM Agreement doesn't have a banking record.
There is a field on the PM Agreement called as Management Fee.
I want to pull this Management Fee from the PM Agreement to the Banking Record linked to the Lease Agreement.
Can anyone please suggest a way to this.
Thanks
Finney
trigger updateMangFee on Banking__c(before insert)
{
for(Banking__c b:Trigger.new)
{
Id inventoryRecordId=b.Agreement__r.Inventory__r.Id;
Agreement__c tempAgg=[SELECT Management_Fee__c FROM Agreement__c WHERE Type='PM' AND Inventory__c=:inventoryRecordId];
//assigning the value to banking record
b.Management_Fee__c=tempAgg.Management_Fee__c ;
}
}