I have one similar problem asked here. But My Objects are Project(Parent) -- > Milestone(Child) --> Action(GrandChild)..
I have tried using the External Id. But I am not sure how I will access Milestone.
This line of code..
newOpp.Account = new Account(ExternalId__c = accNew.ExternalId__c); //set parent ref
Here is the referencing Account, how can I do this for custom relations. How I can reference object instead of Id.
Project__c proj = new Project__c(ExternalId__c = newProj.ExternalId__c); // when crating milestone newMileStone.Project__c = proj; // when i tried this, it says i have to pass id instead of project.
If any one has done this before, I would like to get some inputs.
I have also tried @Avidev9's code.
From that piece of code, there is something I couldn't understand completely. After inserting
newOpportunityList, maps values are becoming null somehow. Tried debugging a lot. But no luck reaching the solution.