enter image description hereI am Using visualforce component for insert and updating child record. this component is reusable for multiple objects, like account, contact, etc., as like we can use this. I am doing DML inside a component. this component just receives a parentId through attribute, and we need to perform adding rows (childRecords) and need to save. Please suggest me how to resolve this issue

  • 3
    Hi DSuresh, welcome to SFSE! Please take the time to visit the Help center and read How do I ask a good question. If you post the code for your component and any related controller, I'm confident you'll find plenty of people willing to assist you.
    – crmprogdev
    Jul 25, 2016 at 14:07
  • @Dupada DS Have you fixed this? If so, please add the solution as answer and accept it. Jul 26, 2016 at 7:30
  • Closing this as a dupe of another question even though this one came first — they clearly relate to the same error, but the other includes some more information and has what I believe to be the correct answer.
    – Matt Lacey
    Jul 27, 2016 at 6:10

1 Answer 1


If you are receiving parentId through the attribute then before using parentId in the DML, use String.escapeSingleQuotes(parentId) and then use it in the DML.

Hopefully it will solve your problem.

Since you have not shared the code, it is just a guess.

Not the answer you're looking for? Browse other questions tagged .