Skip to main content
added 3 characters in body
Source Link
Keith C
  • 137.3k
  • 29
  • 218
  • 458

In apex when we get UNABLE_TO_LOCK exception,most of the solutions are referring to use FOR UPDATE clause in the SOQL.

My questions are:

  • My Doubt is what if Already some other record has lock before running the SOQL ,will the query return that record?
  • And if UNABLE_TO_LOCK exception is coming for Parent record of the failed record, then if we use FOR UPDATE while fetching the child record will work?
  • and what if that query is returning records where more than two records have same parent, how will FOR UPDATE will lock parent records at that time?
  1. My Doubt is what if Already some other record has lock before running the SOQL ,will the query return that record?
  2. And if UNABLE_TO_LOCK exception is coming for Parent record of the failed record, then if we use FOR UPDATE while fetching the child record will work?
  3. And what if that query is returning records where more than two records have same parent, how will FOR UPDATE will lock parent records at that time?

In apex when we get UNABLE_TO_LOCK exception,most of the solutions are referring to use FOR UPDATE clause in the SOQL.

My questions are:

  • My Doubt is what if Already some other record has lock before running the SOQL ,will the query return that record?
  • And if UNABLE_TO_LOCK exception is coming for Parent record of the failed record, then if we use FOR UPDATE while fetching the child record will work?
  • and what if that query is returning records where more than two records have same parent, how will FOR UPDATE will lock parent records at that time?

In apex when we get UNABLE_TO_LOCK exception,most of the solutions are referring to use FOR UPDATE clause in the SOQL.

My questions are:

  1. My Doubt is what if Already some other record has lock before running the SOQL ,will the query return that record?
  2. And if UNABLE_TO_LOCK exception is coming for Parent record of the failed record, then if we use FOR UPDATE while fetching the child record will work?
  3. And what if that query is returning records where more than two records have same parent, how will FOR UPDATE will lock parent records at that time?
added 35 characters in body; edited title
Source Link
Keith C
  • 137.3k
  • 29
  • 218
  • 458

UNABLE_TO_LOCK Exception, will it be solved if i use FOR UPDATE clause? and parent/child record questions

In apex when we get UNABLE_TO_LOCK exception,most of the solutions are referring to use FOR UPDATE clause in the SOQL. 

My Doubt is what if Already some other record has lock before running the SOQL ,will the query return that record? And if UNABLE_TO_LOCK exception is coming for Parent record of the failed record, then if we use FOR UPDATE while fetching the child record will work? and what if that query is returning records where more than two records have same parent, how will FOR UPDATE will lock parent records at that time?questions are:

  • My Doubt is what if Already some other record has lock before running the SOQL ,will the query return that record?
  • And if UNABLE_TO_LOCK exception is coming for Parent record of the failed record, then if we use FOR UPDATE while fetching the child record will work?
  • and what if that query is returning records where more than two records have same parent, how will FOR UPDATE will lock parent records at that time?

UNABLE_TO_LOCK Exception, will it be solved if i use FOR UPDATE clause?

In apex when we get UNABLE_TO_LOCK exception,most of the solutions are referring to use FOR UPDATE clause in the SOQL. My Doubt is what if Already some other record has lock before running the SOQL ,will the query return that record? And if UNABLE_TO_LOCK exception is coming for Parent record of the failed record, then if we use FOR UPDATE while fetching the child record will work? and what if that query is returning records where more than two records have same parent, how will FOR UPDATE will lock parent records at that time?

UNABLE_TO_LOCK Exception, will it be solved if i use FOR UPDATE clause and parent/child record questions

In apex when we get UNABLE_TO_LOCK exception,most of the solutions are referring to use FOR UPDATE clause in the SOQL. 

My questions are:

  • My Doubt is what if Already some other record has lock before running the SOQL ,will the query return that record?
  • And if UNABLE_TO_LOCK exception is coming for Parent record of the failed record, then if we use FOR UPDATE while fetching the child record will work?
  • and what if that query is returning records where more than two records have same parent, how will FOR UPDATE will lock parent records at that time?
Source Link

UNABLE_TO_LOCK Exception, will it be solved if i use FOR UPDATE clause?

In apex when we get UNABLE_TO_LOCK exception,most of the solutions are referring to use FOR UPDATE clause in the SOQL. My Doubt is what if Already some other record has lock before running the SOQL ,will the query return that record? And if UNABLE_TO_LOCK exception is coming for Parent record of the failed record, then if we use FOR UPDATE while fetching the child record will work? and what if that query is returning records where more than two records have same parent, how will FOR UPDATE will lock parent records at that time?