You need to sign in to do that
Don't have an account?
Board salesforce
Trigger to restrict duplicate opportunitylineitems
Hi Techie's,
Can any one help out with a trigger that restricting dupicate opportunitylineitems
Thanks,
Ram.
Can any one help out with a trigger that restricting dupicate opportunitylineitems
Thanks,
Ram.
All Answers
You can use below options to avoid duplicacy :
1) Make an external field on Oppotunity Line Item,it will protect from duplicate entires.
2) Make a set of Line Item Ids as Set<Id> ids = new Set<Id>();
Since Insert or updated operation does not works on set you need to convert this into List and the complete your operation with List.
Hope this helps you!
Please accept my solution as Best Answer if my reply was helpful. It will make it available for other as the proper solution.Let me know if anything else.
Best Regards
Narveer
Can you help in this
getting below error while i insert a new opportunitylineitem
Apex trigger OppotunitylineitemDuplicateCheckTrigger caused an unexpected exception, contact your administrator: OppotunitylineitemDuplicateCheckTrigger: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object: Trigger.OppotunitylineitemDuplicateCheckTrigger: line 14, column 1
it works like charm.