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
jkucera2jkucera2 

Can I reference a parent record before inserted?

For example - would this work?

feedItem f=new feedItem();
//some code to assign required fields;
feedComment c=new feedComment();

c.feedItemId=f.Id;

insert f;
insert c;

 

Best Answer chosen by Admin (Salesforce Developers) 
jkucera2jkucera2

Ok - I stopped being lazy - you cannot reference a parent before insert.  It isn't a pointer, but takes the actual value at the time of assignment.