Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

ContentDocumentLink example in jS

//Create Document Parent Record
Account acc = new Account(Name='Test Account');
Insert acc;
 
//Create Document
ContentVersion cv = new ContentVersion();
cv.Title = 'Test Document';
cv.PathOnClient = 'TestDocument.pdf';
cv.VersionData = Blob.valueOf('Test Content');
cv.IsMajorVersion = true;
Insert cv;
 
//Get Content Documents
Id conDocId = [SELECT ContentDocumentId FROM ContentVersion WHERE Id =:cv.Id].ContentDocumentId;
 
//Create ContentDocumentLink 
ContentDocumentLink cdl = New ContentDocumentLink();
cdl.LinkedEntityId = acc.Id;
cdl.ContentDocumentId = conDocId;
cdl.shareType = 'V';
Insert cdl;
Comment

PREVIOUS NEXT
Code Example
Javascript :: using fetch hook 
Javascript :: simple promise 
Javascript :: ASPxGridView - How to trigger the CustomButtonCallback event 
Javascript :: javascript query corrector 
Javascript :: how to escape double quotes in json 
Javascript :: the key import is reserved 
Javascript :: set value as object in react hooks 
Javascript :: graphql get item by id from strapi react 
Javascript :: cercle progress bar angular 
Javascript :: Flutter retrieve data from Json url 
Javascript :: React Tools - Suspense 
Javascript :: js set cursor final input 
Javascript :: pass values and functions from a Child component to a Parent using a ref 
Javascript :: express pass data between middleware 
Javascript :: jquery dropdown options in laravel 
Javascript :: Public properties can be created via Static public fields 
Javascript :: recharts area chart 
Javascript :: desctructuring in react with aliases 
Javascript :: javascript returns odd 
Javascript :: variable hoisting 
Javascript :: eslint failed to load react 
Javascript :: Mapping page number to index 
Javascript :: date filter in angular 8 
Javascript :: convert java object to json 
Javascript :: mm2javascript 
Javascript :: discord-buttons collector 
Javascript :: load js on only homepage wp 
Javascript :: {"javascript error: Invalid or unexpected token c# selenium 
Javascript :: trackpad scrolling detected multiple times 
Javascript :: how concatenate arrays in es6 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =