+ Start a Discussion
Tien Tran 29Tien Tran 29 

How to upload a file to a case and change the ownerID using ContentVersion?


I am migrating all tickets from Jira to Salesforce. I successfully imported cases and case comments. In order to upload a file to a case, I'm using ContentVersion object and writing a trigger to update FirstPublishLocationId to the Id of a case after insert. The files are uploaded to a case but the OwnerId field isn't affected. The owner is the user running the API by default.

I read some posts and they said that this OwnerId is only updatable, not creatable. 

I tried to export all records from ContentVersion object with the hope that I can get the ID and update the OwnerId. The problem is I don't see the file which I uploaded to Salesforce using the API in the report.

I am really stuck. Can you please advise how to update the owner of the file? Or you have any other approaches to upload files to a case. Please advise.

Thanks in advance.


Tien Tran 29Tien Tran 29
After follow this KB https://help.salesforce.com/articleView?id=000353032&language=en_US&mode=1&type=1 to enable "Query All Files" permission, I'm able to export all files from ContentVersion / ContenDocument and update OwnerId but from the UI, it doesn't change, :(.

User-added image

If I click on "View File Detail", the owner is correct "Tina Tran". I have no idea why it's inconsistent. Please advice.

User-added image
Abhishek BansalAbhishek Bansal
I think this is just the refresh issue. You can clear the cache and load the page again.
Tien Tran 29Tien Tran 29
Hi Abhishek,
Thanks for your answer. I cleared the cache, refreshed the page (F5/Ctrl+F5), logged out / logged in again, even tried with another browser (Firefox). The issue remains.
Abhishek BansalAbhishek Bansal
Is it possible to connect on a call and have a look at your issue?
If yes then please drop an email/message to one of the following:
Gmail: abhibansal2790@gmail.com
Skype: abhishek.bansal2790
Phone: +917357512102(WhatsApp)
Tien Tran 29Tien Tran 29
Hi Abhishek, I've sent you a message on Skype.