• ShreyasMangalvedhekar
  • NEWBIE
  • 10 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
I Have written code to create the ContentVersion, its getting created successfully but without extension, 
I need to place extension, any suggestion on same ? folowing is my code : 
@AuraEnabled
    public static boolean saveTheFile(String base64Data, String contentType, string filename) { 
User-added image
        base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8');
         /*Start : File Attachment as Files Object*/ 
            ContentVersion conVer = new ContentVersion(); //Create the COntentVersion 
            conVer.ContentLocation = 'S'; // S specify this document is in SF, use E for external files
            conVer.PathOnClient = 'Proposal'; // The files name, extension is very important here which will help the file in preview.
            conVer.Title = fileName; // Display name of the files
        	conVer.pathOnClient = '/file';
            conVer.VersionData = EncodingUtil.base64Decode(base64Data); // converting your base64 string to Blog
            insert conVer;
            //Create ContentDocumentLink
            ContentDocumentLink cDe = new ContentDocumentLink();
            cDe.ContentDocumentId = [SELECT ContentDocumentId FROM ContentVersion WHERE Id =:conVer.Id].ContentDocumentId;//Link the contentDOcumentID
            cDe.LinkedEntityId = predictID; 
            cDe.ShareType = 'I'; // Inferred permission, checkout description of ContentDocumentLink object for more details
            cDe.Visibility = 'AllUsers';
            insert cDe; 

            //Update the Filename at the end once the Content Documents are created.
                    
        return true;
      
    }

 

HI all,

I have cleraed the all 4 superbade which are requied for PD2 and also compleated the PD2 mutiplechoice exam,but still wont recived the email to inergate the trailhed account and webassor account, do i need to take follow with anyone or it take time from salesforce to identify same ? any one have experience with same.... 

I Have written code to create the ContentVersion, its getting created successfully but without extension, 
I need to place extension, any suggestion on same ? folowing is my code : 
@AuraEnabled
    public static boolean saveTheFile(String base64Data, String contentType, string filename) { 
User-added image
        base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8');
         /*Start : File Attachment as Files Object*/ 
            ContentVersion conVer = new ContentVersion(); //Create the COntentVersion 
            conVer.ContentLocation = 'S'; // S specify this document is in SF, use E for external files
            conVer.PathOnClient = 'Proposal'; // The files name, extension is very important here which will help the file in preview.
            conVer.Title = fileName; // Display name of the files
        	conVer.pathOnClient = '/file';
            conVer.VersionData = EncodingUtil.base64Decode(base64Data); // converting your base64 string to Blog
            insert conVer;
            //Create ContentDocumentLink
            ContentDocumentLink cDe = new ContentDocumentLink();
            cDe.ContentDocumentId = [SELECT ContentDocumentId FROM ContentVersion WHERE Id =:conVer.Id].ContentDocumentId;//Link the contentDOcumentID
            cDe.LinkedEntityId = predictID; 
            cDe.ShareType = 'I'; // Inferred permission, checkout description of ContentDocumentLink object for more details
            cDe.Visibility = 'AllUsers';
            insert cDe; 

            //Update the Filename at the end once the Content Documents are created.
                    
        return true;
      
    }