+ Start a Discussion
phil.vaseyphil.vasey 

Exception: duplicate value found: <unknown> duplicates value on record with id: <unknown>: []

Hi

 

I'm new to this so please forgive my ignorance.

 

I'm getting the exception when:

 

  1. insert an Opportunity
  2. insert a ContentVersion
  3. post the new ContentVersion to the Opportunity's chatter feed
  4. delete the Opportunity

Does anybody know why, and if so, how to overcome the exception?

 

I am using API version 26.0

 

Thanking you in advance

 

 

private static void TestOpportunityDeletion()

{
  // create an opportunity
  Opportunity opp = new Opportunity() ;
  opp.Name = 'Test Name' ;
  opp.StageName = 'Test Stage Name' ;
  opp.CloseDate = Date.Today() ;
  insert opp ;

  // attach a document to its chatter feed
  ContentVersion doc = new ContentVersion() ;
  doc.Title = 'Test Version' ;
  doc.PathOnClient = 'test version.docx' ;
  doc.VersionData = Blob.ValueOf( 'test content' ) ;
  doc.Origin = 'H' ;
  insert doc ;

  FeedItem post = new FeedItem() ;
  post.Type = 'ContentPost' ;

  post.ParentID = opp.Id ;
  post.RelatedRecordID = doc.id ;
  insert post ;

 

  // delete the opportunity
  delete opp ;
}

Best Answer chosen by Admin (Salesforce Developers) 
Jia HuJia Hu
Before ' delete opp ;' add
delete post;

Then your code will work.

All Answers

Jia HuJia Hu
Before ' delete opp ;' add
delete post;

Then your code will work.
This was selected as the best answer
phil.vaseyphil.vasey

Thanks for that - it works a treat.

 

However, does that mean for every SalesForce object that potentially has a chatter feed, we must introduce a trigger which deletes its feed items before it is deleted itself?

Jia HuJia Hu
Usually you don't need to do this.

When you delete a record, the Chatter post on the record will also be deleted, but the file will be left.

In your case, it is a little strange. When you delete the record from the interface, you got the same error.

I will try to figure it out later, when I have time.
mark lee 46mark lee 46
yes you are saying eject You can download Pubg Mobile Lite (https://www.pubglitepc.co/)
  • insert an Opportunity
  • insert a ContentVersion
  • post the new ContentVersion to the Opportunity's chatter feed
  • delete the Opportunity
mark lee 46mark lee 46
I also found a same error I try many methods but all are fail then i get any idea from Yolo Snapchat (https://www.onyolo.co/). then I visit on solution site I cannot found any solution. You can download Yolo Anonymous Apk (https://www.onyolo.co/yolo-apk-for-android/)here.
ralph corralesralph corrales
In a voucher-subsidized competitive market in education services, disputes over the political implications of curriculum will diminish: https://theessayservice.org (https://theessayservice.org/).
pubglitemobile pubglitemobilepubglitemobile pubglitemobile
PUBG Lite is a free form of PUBG for gamers how to play who play on the PCs. Right now, PUBG's portable rendition is accessible for nothing to download and play on the cell phones, and is accessible on both the Google Play Store and Apple's App Store. PUBG Lite was at that point accessible in couple of nations and now it is set to advance toward India.
Devender GuptaDevender Gupta
DTC BUS APP – #1 App for All mode of public transports (DMRC Metro, NMRC Metro ,DTC Bus Routes, Auto) Best DTC App in Delhi-NCR Cities.

DTC Bus App has been downloaded by more than 1 million users, and has changed the way we check DTC BUS Routes (https://dtcbus.online/dtc-routes/). Initially launched in the year of 2015, DTC BUS app (https://dtcbus.online/apk/) has now become immensely popular across all platforms.

DTC BUS APP Features

Delhi Metro Map(DMRC), Noida-Greater Noida Metro Map (NMRC) ,Route, fare, Journey Time, Card Recharge, Station Information with first and last train timings.

Delhi DTC Bus Route Detail with Source and Destination Routes.

Orange cluster bus operated by DIMTS also included.

Nearest Metro Station and DTC Bus from your Current location with distance.

Airport & Rapid Metro Gurgaon also integrated.

Latest Auto-Fare Chart

Noida Metro (NMRC) city bus is also added upto date.

Up to date data for all types of public transports in NCR , Noida, Gurgaon , Faridabad, Ghaziabad.

https://dtcbus.online/


 
Sacha guiSacha gui
Overwatch Random Hero Generator (https://randomoverwatchhero.neocities.org/) I used this post to build it.
Jack BillalJack Billal
Mr. Jia Hu has given the perfect and correct answer for your. I hope you have alread resolved your problem abou this.
I'm also suffering such a problem with the AndroDumpper app (https://softzforpc.com/androdumpper-for-windows-10-8-7-mac-pc/). It is an Android app, But I have started working to developing it for PC (Windows/Mac) etc. 
John WickJohn Wick
There is an online website where you will get complete facts about movies. You will get all information related to movies from this. Tamilplay (https://reviewscounter.com/tamilplay-download-tamil-movies/)
John WickJohn Wick
One of the best destination for happy birthday wishes (https://www-happybirthdaywishes.com)
Every mother feels her love and appreciation on her special day. From her immense patience to her endless support, there are many things to be grateful for your mother. If you are struggling to find the right way to express the depth of your love and here are some ways to give you happy birthday wishes that inspire you. Whether she is sweet, lovely, kind, or insane, hopefully, there is a message that resonates with you. Happy Birthday Mom (https://www-happybirthdaywishes.com/happy-birthday-mom-birthday-wishes-messages/)
 
Anand Kumar 194Anand Kumar 194
Adobe Photoshop 7.0 (https://samtechnology.org/adobe-photoshop-7-0-free-download-full-version-setup/) free download and also you can check and download Pubg pc download (https://pubgpcdownload.com/) and do check out https://b4blog.net/
gayatri sakalegayatri sakale
Hello,

I do agree with Mr Jia Hu, you should not delete record first, i have faced the similar issue while I and my small team were developing an app for a client (daily calory tracking app in health category) ultimately we removed all record and did the set up again, it works! By the way, you may try this (https://download.zone/rstudio-for-windows-download/)
hope it may work for you and others,

Thanks,

Gayatri
stacy campbellstacy campbell
Hello Gayatri,

I do agree with your concern and Mr Jia Hu as well. I did resolve the bug later as per you and Mr Hu explained. It is on this page: https://filehulk.com/download-avast-internet-security/ (https://filehulk.com/download-avast-internet-security/)
https://freefilehippo.com/game-loop-android-emulator/

Thanks
miranda davis 1miranda davis 1
Mr J Hu stated the right solution, however I have also find something helpful here : https://filehulk.com/driver-booster-download/ and
https://download.guru/top-10-best-vpn-software/

Thanks and regards,
John Bryant 24John Bryant 24
Mr. Jia Hu has given the perfect and correct answer for your. I hope you have alread resolved your problem abou this.
https://thevpnforpc.com/turbo-vpn-for-pc/
 
jadi harijadi hari
some computer solution also available here  (http://www.newforpc.com)

https://www.toolpub.com/kinemaster-for-pc/
rakesh ranghanirakesh ranghani
If you want to download and install Apps and Games for PC Windows and Mac Clicks Here. (https://www.helpsforpc.com/) and also Visit Newsforpc.com (https://www.newsforpc.com/) for PC Windows and Mac information. 
Lera ZorinaLera Zorina
I think Mr. Jia Hu has given the perfect and correct answer for solve your problem. I hope that you have alread solved your problem about this.If you need any PC SOFT  (https://www.thepcsoft.net).Please Visit this site.
Ashish Sharma 406Ashish Sharma 406
Thanks for sharing this information it's really helpfull 
Best Regards
Ashish Sharma
Digital Marketing Agency Indore (https://indiancyberdude.com)
Ashish Sharma 406Ashish Sharma 406
Thanks for sharing it's really helpful and informative for me i really appreciate your help and work.

best regards
love shayari (https://xn--i1b3gad2a2cdg.com)
bishnu sahu 1bishnu sahu 1
Thanks for sharing it's really helpful and informative for me i really appreciate your help and work.
best regards
Kinemaster Pro Apk Download
bishnu sahu 1bishnu sahu 1
Thanks for sharing it's really helpful and informative for me i really appreciate your help and work.
best regards
MP3 Rocket Download
bishnu sahu 1bishnu sahu 1
Wowww great articles thanks for sharing.
best regards
Fourthspeaker
also check below some Earphones for you:-
1.  Sennheiser CX Sport Review (https://fourthspeaker.com/sennheiser-cx-sport-review/)
Abu HanifAbu Hanif
Thanks for share.
Regards
Kinemaster Pro APK Download
Manish Mishra 44Manish Mishra 44
I think this is one of the most important information for me.
And I am glad studying your article. However, should remark on some normal issues, the website taste is ideal, the articles are truly great: D. Excellent job, cheers
If you are gaming lover (https://www.gamingfreak.in" target="_blank) then you can visit our Web site . If you are looking online job portal visit to quickjobsalert (https://quickjobsalert.com" target="_blank)
 
rakesh ranghanirakesh ranghani
Turbo VPN (https://www.helpsforpc.com/turbo-vpn-for-windows/) is a free VPN client that offers free VPN proxy service giving you the chance to unblock sites and applications.
With Turbo VPN you will have more security and privacy at the time of surfing the internet. Turbo VPN provides a stable connection which is very helpful nowadays.
Arenteiro teiroArenteiro teiro
MP3Juices Free MP3 Downloads (https://arenteiro.com/mp3juices-free-mp3-downloads/): Right now we have so many applications and online players on the internet. We are always updated in information about give you the best mp3 player for our audience.Mp3juices (https://arenteiro.com/mp3juices-free-mp3-downloads/) In this article, we providing information about the download mp3 mp4 songs in the application and online from the internet. Please go down below and read about the features of mp3 and mp4 downloader here and download the application here.emp3juices (https://arenteiro.com/mp3juices-free-mp3-downloads/).
Arenteiro teiroArenteiro teiro
MP3Juices Free MP3 Downloads: Right now we have so many applications and online players on the internet. We are always updated in information about give you the best mp3 player for our audience. In this article, we providing information about the download mp3 mp4 songs in the application and online from the internet. Please go down below and read about the features of mp3 and mp4 downloader here and download the application here.
.<a href="https://arenteiro.com/mp3juices-free-mp3-downloads/">MP3Juices</a>
 
Arenteiro teiroArenteiro teiro
Movierulz2 (https://arenteiro.com/movierulz2/): The right place for free movie streaming sites is Movierulz. In this article, I am going to tell you how to download the TV show movies in the HD quality. For many years watching the movies online or the web series is a hot topic. There are many fake websites by which the people are tired of visiting. To make your work easier, there is the trending and the leading movie downloading site which is Movierulz.
Arenteiro teiroArenteiro teiro
Vegas crime simulator mod apk (https://arenteiro.com/vegas-crime-simulator-mod-apk-download/" target="_blank): Vegas Crime Simulator MOD money that you are being transmitted to something like a criminal area, in which you can echo something or carry out a task. Destroy the robbery thieves or even on the streets, steal the vehicles, purchase the mighty machine gun, destroy capacity in Vegas. Our character is determined of becoming the face of the criminal act, and now you’re helping him use it. All the more arms and equipment which won’t even make you irritated. Throw money for just the coolest commercial vehicles and aircraft, have good entertainment when you prefer.