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
sagar077sagar077 

Create a button on Quote 'Populate Root Id', must work for Classic and Lightning both Create a field on QuoteLine "Root Id" Lookup (QuoteLine) On click of this Button we need to populate the Parent bundle Id (Parent Quote Line Item) on every child Lines I

Create a button on Quote 'Populate Root Id', must work for Classic and Lightning both
Create a field on QuoteLine "Root Id" Lookup (QuoteLine)
On click of this Button we need to populate the Parent bundle Id (Parent Quote Line Item) on every child Lines
Input to your Class will be QuoteId from Quote Detail page.
NOTE: You need to identify fields at QuoteLine level where you can have immediate Parent QuoteLine Id and Bundle Product
 
For Example :
Quote Q-00001 :
QuoteLines:
  • QL-00001 (Product A)
  • QL-00002 (Product B)
  • QL-00003 (Product C)
  • QL-00004 (Product D)
  • QL-00005 (Product E)
  • QL-00006 (Product F)
  • QL-00007 (Product G)
  • QL-00008 (Product H)
  • QL-00009 (Product I)
  • QL-00010 (Product H)
  • QL-00011 (Product J)
  • QL-00012 (Product K)
  • QL-00012 (Product L)
  • QL-00013 (Product M)
  • QL-00014 (Product N)
  • QL-00015 (Product O)
  • QL-00016 (Product P)
  • QL-00016 (Product Q)
  • QL-00001 (Product C)
Output: Highlighted in Green
Quote Q-00001 :
QuoteLines:
QL-00001 (Product A) [ROOT_ID : Null]
QL-00002 (Product B) [ROOT_ID : QL-00001]
QL-00003 (Product C) [ROOT_ID : QL-00001]
QL-00004 (Product D) [ROOT_ID : QL-00001]
QL-00005 (Product E) [ROOT_ID : QL-00001]
QL-00006 (Product F) [ROOT_ID : QL-00001]
QL-00007 (Product G) [ROOT_ID : QL-00001]
QL-00008 (Product H) [ROOT_ID : QL-00001]
QL-00009 (Product I) [ROOT_ID : QL-00001]
QL-00010 (Product H) [ROOT_ID : QL-00001]
QL-00011 (Product J) [ROOT_ID : QL-00001]
QL-00012 (Product K) [ROOT_ID : QL-00001]
QL-00012 (Product L) [ROOT_ID : QL-00001]
QL-00013 (Product M) [ROOT_ID : NULL]
QL-00014 (Product N) [ROOT_ID : QL-00013]
QL-00015 (Product O) [ROOT_ID : QL-00013]
QL-00016 (Product P) [ROOT_ID : QL-00013]
QL-00016 (Product Q) [ROOT_ID : QL-00013]
QL-00001 (Product C) [ROOT_ID : QL-NULL]

Please help me i am new apex code
Thank You
ShirishaShirisha (Salesforce Developers) 
Hi Sagar,

Greetings!

Can you please check the below blog which is similar to your requirement:

https://www.simplysfdc.com/2012/11/custom-button-to-prepulate-field.html

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Warm Regards,
Shirisha Pathuri