How to create a notes under a record dynamically in Salesforce?

Sample Code:

        Member__c e = [SELECT Id, Comments__c FROM Member__c WHERE Id = 'a00U000000352lq'];
        Note n = new Note();
        n.body = e.Comments__c;  //Comments__c is TextArea field
        n.parentId = 'a00U000000352lq'; //Id of the record
        n.title = 'Sample Note';
        insert n;

No comments:

Post a Comment