On the Standard-Related-List "Notes" there is a New Button. This New Button opens a Panel on the bottom of the screen like this:
How can I invoke the opening of this "New Note" Panel? I've tried so far (from Visualforce-context) sforce.one.createRecord('ContentNote',null,{Title:"test"});
which should pretty much be similar to $A.get("e.force:createRecord");
but unfortunately, this only looks very poor:
It is important to say, that there is no field on ContentNote which allows to link the note to the parent object. This is missing, because one ContentNote can relate to many parent SObject, so it is an m:n Relationship, hence a Junction Object is used in the data model called ContentDocumentLink. I suppose this is one of the reasons, why createRecord is doing so bad for the ContentNote entity.
Question
Is there any way to make it better in order to create new notes in my own components and visualforce pages? Or do I have to write my Notes editor from the scratch?
Best Answer
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-->
JavaScript Controller:-
css:-
APEX Controller:-
Once the note is getting created, I am inserting the ContentDocumentLink object to link the current record to this note.
Hope it helps you.