ERROR: variable ParentID does not Exist on running the following lines

Note n = new Note();
try {               
    n.Title='New Note';
    insert n;

You usually see this sort of error when you introduce a naming collision by creating a custom class which shares its name with a standard object/class. You can make sure you are creating an SObject instead of an instance of the custom class by prepending Schema. to your type:

Schema.Note n = new Schema.Note();
| improve this answer | |
  • What is this Schema, i didn't undestand...will please tell me – Ketan Thakare Jul 21 '17 at 3:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.