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
AbAb 

Get the Id of inserted records and the id of parent (get id of inserted quote and its opporunity)

Hello,

insert cloneQuoteList; 

I am inserting the list of quote.
How can i get the Opportunity Id and Inserted qute id after the insert.

I want to use the Ids to insert the cloned quote line items

thank you
Best Answer chosen by Ab
Om PrakashOm Prakash
for(Quote obj : cloneQuoteList){
   System.debug(obj.Id); // Quote ID
   System.debug(obj.OpportunityId); // ID for the opportunity associated with the quote.
}


 

All Answers

Om PrakashOm Prakash
for(Quote obj : cloneQuoteList){
   System.debug(obj.Id); // Quote ID
   System.debug(obj.OpportunityId); // ID for the opportunity associated with the quote.
}


 
This was selected as the best answer
AbAb
Hello,
the problem is the Id of the quote i cant get it before i insert them.
and the id of the opportunity is difficult to map after the quote is inserted
 
I want something like
QuoteTemp.OpportunityID = SomeOppId
QuoteList.add(QuoteTemp)
insert QuoteList;

Map of QuoteId, Opportunity Id

​​​​​​​
GauravGargGauravGarg

@Sandrine,

you want to add Opportunity-Id or Quote-Id? Opportunity-Id you can add in Quote insert calls the one you mentioned above can work for your use-case. 
Can you share what exactly the issue here?

Thanks,

Gaurav
Skype: gaurav62990