6

Disregard my ill-informed comment to your OP ContentNote is saved with key prefix 069 which is a ContentDocument. And, ContentDocument is the parent of ContentVersion (key prefix of 068). You can think of the ContentDocument as the header and ContentVersion as the actual "note" -- with multiple versions supported. As you edit the Note and click Save, a ...


5

Using visibility to all users: link.Visibility = 'AllUsers'; You should also set the share type to this: link.ShareType = 'I'; Which means: Inferred permission. The user’s permission is determined by the related record. For shares with a library, this is defined by the permissions the user has in that library. You can find more info here


5

I have Created one custom component which can be used as a quick action and it enables you to create the note related to the current record. Look what I have done:- Here is my code:- <--component--> <aura:component controller="CreateNoteRecord" implements="lightning:actionOverride,force:appHostable,flexipage:...


4

The standard limit on inserting ContentVersion, which underlies Notes, is 200,000 per day. I suspect you've reached that limit. Unfortunately, I am not aware of a way to view the consumption of this limit within the org. It's not available in System Overview or via the Limits API. You may need to wait a day for it to roll over.


4

In short They are not under Note, but instead ContentNote Notes and attachments are for attachments and the "old" note records. Enhanced notes have their own related list (called "Notes"). Longer form There's the Considerations for Setting up Notes where below point is taken from the doc and answers your 2nd question: To set up Notes, ...


3

FYI to anyone else struggling with this as I am, this is the trigger firing order when the "New" Content Note button is clicked: ContentVersion BEFORE_INSERT ContentDocument BEFORE_INSERT ContentDocument AFTER_INSERT ContentDocumentLink BEFORE_INSERT ContentDocumentLink AFTER_INSERT ContentDocument BEFORE_UPDATE ContentDocument AFTER_UPDATE ContentVersion ...


3

As per Salesforce support, with API v45 we can now use ContentNote with HTML without messing about with unsupported chars. The only official documentation the support was able to point me to was: https://releasenotes.docs.salesforce.com/en-us/spring19/release-notes/rn_sales_productivity_notes.htm With this version of API i wasn't so far been able to break ...


3

I'm the author of the ContentNote library referred to in the linked answer. I'll reiterate the things I'm aware of that you need to do to prepare note content for insertion: Replace all basic HTML characters (<>"'&) with their corresponding entities (&amp; and friends). Replace all line breaks with <br> (taking care with Windows CRLF/...


3

I created a Salesforce Case on this and that was handled promptly and effectively. Unfortunately the answer was that the current implementation supports the "one at a time" situation that arises from the user interface but does not support the "bulk" case as the ContentDocument objects are created one at a time from the ContentNote objects.


3

Well you have two problems here: You're trying to assign to a single Lead record. Right now, you're getting an error because the query returns zero records. If you fix just the query, you will likely get multiple records, also an error. You're trying to query where a Lead record has an Id matching OwnerId on another record. That will never happen. So at ...


3

The first thing to try is this in your Visualforce page for each string in the list: <apex:outputText value="{! content } escape="false"/> as the apex:otuputText documentation offers the (rather confusingly explained) attribute option of: escape Boolean A Boolean value that specifies whether sensitive HTML and XML characters should be escaped in ...


3

The link between ContentNote and any related record is stored in the ContentDocumentLink. So, if you're writing a trigger or Executing Anonymous Code, you need to query all ContentDocumentLinks related to your Opportunity. So, something like this: Map<Id,List<ContentNote>> noteMap = new Map<Id,List<ContentNote>>(); for(...


3

I know test methods should not see any data except the data created in test context... This is untrue. Certain types of metadata are exposed in unit tests. Isolation of Test Data from Organization Data in Unit Tests says: However, objects that are used to manage your organization or metadata objects can still be accessed in your tests such as: And goes on ...


2

You have to query ContentNote object. Here is the schema for ContentNote Objects:


2

I found a solution here: Importing Notes to the ContentNote object using the Apex Data Loader. Step 4. Relating the inserted Note to a Parent Record with the Apex Data Loader Once the Note is inserted we need to relate it to the parent record. Since the note is stored in Content, we need to insert a record to the Content Document Link table in order ...


2

To help folks migrate from Classic Notes (Note) to Enhanced Notes (ContentNote) I've developed open source project on GitHub: https://github.com/DouglasCAyers/sfdc-convert-notes-to-chatter-notes And if you're converting notes you might also want to convert Classic Attachments (Attachment) to Salesforce Files (ContentVersion): https://github.com/...


2

SOSL queries are tested similar to callouts using something like a Mock called fixedSearchResults(). See Adding SOSL Queries to Unit Tests in the Apex Docs. Here's an example from the docs on one way it can be used: @isTest private class SoslFixedResultsTest1 { public static testMethod void testSoslFixedResults() { Id [] fixedSearchResults= new ...


2

The sharing for the new Notes tool (API-name ContentNote) is arranged in the same way as for the already existing Salesforce Files functionality. The datamodel looks like this: https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_erd_contentnote.htm As you can see, the sharing is managed via the ContentDocumentLink object. You can ...


2

You would need to enable the new notes feature as mentioned in following help document, if not done already: Considerations for enabling the enhanced note-taking tool (Notes) and using Files Other cause could be that your API version of class/trigger to a lower version than 32.0. From documentation: ContentNote: Represents a note in Salesforce. This ...


2

Looking at the SOAP API documentation for ContentNote (yeah, I know you're using the REST API), we see that the Content field stores (and thus expects) a base64-encoded string. Trying to put a normal UTF-8 string into this field will result in Salesforce displaying a sequence of strange (and possibly unprintable) characters. Base64 encoding your content ...


2

You will get this error message when you have hit the limit. Salesforce allows limited number of content version that can be added to org in every 24 hours. Environment Type Default Maximum Production 200,000 500,000 Sandbox 36,000 500,000 Developer Edition 2,500 2,500 Trial Environments 2,500 2,500 You can raise a case ...


2

There exists a relation between ContentNote and ContentDocumentLink. In order to get the ContentNote or ContentVersion, there are different ways of achieving it. Using 2 SOQL's You will have to first query on ContentDocumentLink using the LinkedEntityId i.e. in your case it will be ContactIDs and collect all the ContentDocumentId's. Then after getting the ...


2

Having found this ConvertNotesToContentNotesService class - thanks for posting that code Doug Ayers - I realised that there is a Blob field on the ContentVersion object after all that I had overlooked because it is called "VersionData" not "Content"... So instead of updating ContentNote, I am now successfully inserting a ContentVersion object created like ...


2

Update : If you are using Enhanced Notes, then you will have to write a trigger on ContentDocument object. When using Enhanced Notes, it does not create Notes rather it creates ContentNote records. You can find the structure of the ContentNote which is much more complex, so you will have to change your trigger to be on ContentDocument and not on Note And ...


2

You need to do a couple of things here. 1. You need the list of your Opportunities. 2. Then you need a list of the ContentDocumentLinks that are related to the Opportunities in that list. 3. Then we can get all ContentNotes that are not part of anything or related to any object. List<Opportunity> oppList = [SELECT Id FROM Opportunity]; ...


2

Enhanced Notes count towards File Storage and can be inferred from documentation... ContentNote is built on ContentVersion


1

Object model reminder: https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_erd_contentnote.htm Notice that while it does use ContentVersion and ContentDocumentLink it does NOT use ContentDocument. Also you might want to consider putting the trigger on ContentDocumentLink because otherwise you allow a possible scenario where a non-...


1

There are many things you need to reconsider in your code:- The contentNote object field Content is of type blob(base64) but you are trying to put string value. Use Blob.valueOf('') The createdById having properties as follows:- Create (for users assigned the Set Audit Fields Upon Creation permission), Defaulted on createFilter, Group, Sort, Update (for ...


1

As per error, the object which you are accessing is not available. So may be your IF condition is throwing error. Please try to use try catch block and throw custom exception in catch block also. public class ContentVersionTriggerHandler { public static void beforeInsertUpdate( List<ContentVersion> newList ) { try { for( ...


1

This answer only relates to workarounds where the calling code can be modified: it is not a general solution to the question. It would be great if there was a pattern that caused the platform to behave in the normal pattern of bulk calling a trigger. Thanks to Adrian's comments, I realized that my problem of: bulk update in controller platform layers ...


Only top voted, non community-wiki answers of a minimum length are eligible