function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Trigger to pull ID from Child to Parent Record

I am currently having an issue building a simple trigger to update a parent record with the record ID of a child. We use a survey system to write into the child object and now we want to pull the latest ID to the parent to use in an email template the same way the survey is sent out originally.


Parent Object: Portfolio__c

Child Object: BOV__c


Any help would be greatly appreciated.


Right now I am just playing around with the query and can't get it to work correctly.


Edit: Right now using SOQL query I can simulate the query needed with;


Select b.Id, b.Portfolio__c, b.Portfolio__r.Name from BOV__c b WHERE b.Portfolio__r.Name != '' (I just used blank to check if I can pull the ID)


I'm just confused on how to initiate this to pull the latest once it has been written in.


Thanks in advance :)




I can help you with this trigger. If you have your gmail/skype id you can share with me or u can get in touch with me




You can retrieve the latestid of records on the basis of "createdDate and "lastmodified" followed by  Order By syntax.