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
venkateshyadav1243venkateshyadav1243 

Trigger for preventing the duplicate records

Hi,

 

I have one opportunity for one opportunity i can add multiple products.

in my products i have one field descrption,for some products have descrption was same.

ex : for one opportunity i added 15 products in this 15 products,5 have descption "XXX"

5  have descption "yyy"

5  have descption "zzz"

i have one preview pdf button in my opportunity for showing the all products details,

right now am fetching all the 15 products descrption in my pdf.

 

 i want  show only  1 xxx,1 yyy,1 zzz, in preview pdf

 

 

Regards

 

IshanIshan

Hi,

 

try like this, may be you are fetching all descriptions from all products under the opportunity record, so use the GroupBy in your query it will give distinct description values........

 

 

Satyendra RawatSatyendra Rawat

Hi,

 

Go step by step.

Fetch the record of current opportunity from  opportunityLineItem , and this data may be helpful for you and

and group by Description using apex code the show the data in vf page, in page level show renderas="pdf"

RockzRockz

Hi Venkat,

 

I hope this link helps you!

 

 

http://salesforcegirl.blogspot.in/2012/02/apex-trigger-to-prevent-duplicate.html

 

http://starrforce.com/2012/05/preventing-salesforce-duplicates/

 

 

Please accept my answer as a solution if my solution was helpful. This will make it available to others as a proper answer. If you felt that I went above and beyond please give me Kudos by clicking on on the star icon.

 

 

Thanks,

Cool Sfdc