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
Priti LokhandePriti Lokhande 

hi everyone.... can I change file extension field in attachment ...

Problem is when case raise along with attachmnet file is uploded but its fileextension is blank because of this im not able to view the file I try with trigger but shhowing error fileextension field is not writable
Foram Rana RForam Rana R
Hi Priti,

Have you added value in the PathOnClient field of ContentVersion?

For Example::
String yourFiles = 'Let's assume this is your binary string of the files';
 
ContentVersion conVer = new ContentVersion();
conVer.ContentLocation = 'S'; // S specify this document is in SF, use E for external files
conVer.PathOnClient = 'ionicLogo.png'; // The files name, extension is very important here which will help the file in preview.
conVer.Title = 'Proposal '; // Display name of the files
conVer.VersionData = EncodingUtil.base64Decode(yourFiles); // converting your binary string to Blog
insert conVer;

Let me know if this helps.


Thanks,
Foram rana
Lukesh KarmoreLukesh Karmore
Hii Priti Lokhande,
you can use  ContentVersion rather than attachment.
please refer this video-
https://www.youtube.com/watch?v=Big0U-Rgnfw&t=14s




Let me know if this helps.
Thanks,
 lukesh k