Hot answers tagged

69

Summer '20 (v49.0) https://resources.docs.salesforce.com/226/latest/en-us/sfdc/pdf/salesforce_summer20_release_notes.pdf Spring '20 (v48.0) https://resources.docs.salesforce.com/224/latest/en-us/sfdc/pdf/salesforce_spring20_release_notes.pdf Winter '20 (v47.0) https://resources.docs.salesforce.com/222/latest/en-us/sfdc/pdf/salesforce_winter20_release_notes....


6

You can always find the list here: https://help.salesforce.com/apex/HTViewHelpDoc?id=whats_new.htm&language=en_US Should the link change in future searching for "past releases" should find it.


6

You can't put "executable" code outside of a method. Also, to actually have a unit test, you need a method marked with @isTest or testMethod. You also have a few other minor issues. @isTest public class TestNoteOnInsert { @isTest static void test() { Lead testLead = new Lead(); testLead.FirstName = 'Test first'; testLead.LastName ...


5

You have to use the correct Relationship Name (Notes). Also you don't need to check for parentId condition again in the inner query.. select Id, Request_Title__c, (SELECT Id, Name FROM Attachments), (SELECT Id, Title FROM Notes) from Request_for_System_Change__c where id='a3K8E0000000BIj'


5

Yes, we can create notes and associate it to multiple records (e.g. Contacts, Opportunity as in picture) like this which is generally available from Winter'16 release: Steps: Create Note and associate to multiple records. We can share this to people or user. This saved notes can be accessible from Files menu. To retrieve the notes ...


5

The Note object that has been around for many years is replaced by the ContentNote object when enhanced notes are enabled. On the underlying SObjects involved, see this ContentNote Objects documentation page that includes this ERD: The many-to-many relationship is achieved through the ContentDocumentLink object.


4

You need to set the parentId field to the Id of the contact, not the Id of the note, e.g. sObject salesforceNote = new sObject(); salesforceNote.type = "Note" XmlDocument requestData = new XmlDocument(); XmlElement title = requestData.CreateElement("Title"); title.InnerText = noteModel.Title; XmlElement body = requestData.CreateElement("Body"); body....


4

You might have applied with sharing in class declaration and that particular record would not be accessible to respective user. that is why you can see records in developerr console but getting null in apex code. with sharing enforce the sharing rules that apply to the current user. To know more about with sharing Click Here


4

As of now you can not transfer attachment from one object to another by just updating ParentId. You will have to create/clone new attachment assign the clone to new parent and delete original copy. List<Attachment> attachmentsToInsert = new List<Attachment>(); List<Attachment> attachmentsToDelete = new List<Attachment>(); ...


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.


3

There has been a step forward regarding reporting on notes. There is a lot of excitement going on with the Lightning Experience. However enhancements for taking notes have also taken place. There is a new version of Notes that was published with Winter 16 and you can report on them. Salesforce help doc on reporting on New Notes: link Salesforce doc on ...


3

The above answer has all the links and it should be upvoted but isn't it easy to go to developer.force.com and search for release notes. You can check using the below link: https://developer.salesforce.com/search?q=release%20notes&language=en


3

Tasks, Events and Notes all have a field named Private (data type boolean) that controls the sharing of these objects. Users visibility would be controlled by hierarchy and entity history. I hope that helps.


3

This error indicates that you are trying to get the sObjectType of your ParentId when it is null. In other words, the new records you are cloning have a ParentId of null. Not sure where you are getting your newD record from, but if you're cloning it somewhere, it's possible you can resolve this issue simply by cloning with preserveId=true. For example: ...


3

According to Support for notes, documents, files and attachments in Salesforce1, notes and attachments aren't supported in Salesforce1 Salesforce1 supports documents that are uploaded through the Files action OR through Chatter. Documents and any attachments uploaded through the Notes and Attachments section on a record list view aren't guaranteed to be ...


3

This is a (fairly) trivial trigger to write. Here's a basic (non-error-proofed) version you could start with: trigger NoteCopy on Note (after insert, after update) { // Notes attached to leads Note[] leadNotes = new Note[0]; // Just notes for leads... for(Note record: Trigger.new) { if(record.ParentId != null && record....


3

This was caused by the Content Limits. In sandboxes, the limit is only 2500. We opened a case and had the limit increased to the maximum, which I believe is 500,000.


3

Yes, or you can save the cost of a global describe using Type.forName: Boolean isNewNotesEnabled = Type.forName('Schema.ContentNote') != null;


3

One cannot independently permission (Content) Notes. To prevent deletion, I think you'll have to go to an Apex trigger to add an error on the before delete event. A very quick example of how to do this would be: trigger NoteTrigger on ContentDocument (before delete) { for (ContentDocument c : Trigger.new) { if (c.FileType == 'SNOTE') { ...


2

You could do this with Visualforce Tab. You can query the note object in the Apex controller like such: SELECT CreatedById,Id,OwnerId,ParentId FROM Note You may need to build some logic to find out the type of parent etc, but I don't really see a technical limitation. To include data from external applications, you can use http requests from the apex ...


2

Select parent.type, count(id) from note group by parent.type You can execute this from the developer console, workbench, data loader, a Visualforce page, etc.


2

Try this trigger code : trigger insertNote on Contact (after insert, after update){ List<Note> noteList = new List<Note>(); if(Trigger.isAfter && Trigger.isInsert){ for(Contact c : trigger.new){ if(c.notes__c != null){ Note newNote = new Note(); newNote.Title = 'Custom Title';...


2

The read-only user won't be able to add notes or Attachments to the Account Object, but should be able to read them. Access to them is inherited from the Account permissions.


2

The easiest way would be to use a visualforce page section to your opportunity page layout. You can use something along these lines with a standard controller: <apex:page standardController="Opportunity" showHeader="false" tabStyle="Opportunity" showQuickActionVfHeader="false" showChat="false"> <apex:relatedList subject="{!...


2

With regards to the SOQL query and accessing all the ContentDocument records. As you found, if you run a SOQL query against all the ContentDocument records, you get 3 records back (in your example case). But if you make a SOQL query for an explicit ContentDocument ID that doesn't come back in the first set of results you can access a 4th record. I believe ...


2

Yes, the notes and attachments on the Lead will be linked to the converted Account and Contact. Here's the salesforce reference All notes and attachments from the lead are converted and attached to the new account and contact. All open activities and activity history from the lead are converted and attached to the new account, contact, and ...


2

I'm presume the issue that you're running into is that you can't use an OrderBy clause in a SubQuery, so you're looking for a way to sort the results. That's something you'll need to do manually in a for loop once the results have been returned. This will be easiest if you first cast the Note Object and the Attachment object records to a common Type so you ...


2

Hi Arun SFDC, We can not directly query on NotesAndAttachment object. However we can query it when used as child query. If you want to show NotesAndAttachment of any custom object then you can make use of below code example. Here in my case I have used Country__c as a custom object. Controller Code: public class CountryController { public ...


2

newDemandNote.createdBy = string.valueOf(eachNote.CreatedById); change to newDemandNote.createdById = eachNote.CreatedById; I believe we can't assign createdById field. This field is not writtable. You may need to give user to set audit fields permission in user's profile. I suggest just remove all audit fields lines .. rest code look good to me


2

What meta-data apiversion is the visualforce page using? I have a page on version 36.0 with the following mark-up which displays the related list. <apex:relatedList list="AttachedContentNotes" /> Also you need to ensure you have enabled enhanced notes in setup > Notes > Note Settings


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