We have a button list button on Order (Bill Now Button). It opens a VF page and executes some actions. After clicking the button, it take a while to be redirected to the VF Page. Some users click it twice or more. When clicked more than once, it displays an this error.

Update failed. First exception on row 0 with id 8016E0000001vPJQAY; first error: UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record: [] Error is in expression '{!init}' in component in page jvco_billnow: Class.JVCO_BillNowLogic.tickBillNow: line 102, column 1 Class.JVCO_BillNowLogic.init: line 72, column 1

There's no effect on the code execution but we are getting this nasty error. Is it possible to disable the list button after a click? This related list is on account. Check the image below.Order Related list on Account


1 Answer 1


By making the content Source of custom button as 'Execute JavaScript' and calling your VF page then can help. Code for the button:

this.disabled = true;<span> </span><font color="#339966">//Disables the button</font>
this.className = 'btnDisabled';/<font color="#339966">/Apply disabled button style(Optional)</font>
window.location='/apex/yourVFPage';<font color="#339966">//Call your VF page here</font>

Let me know this helps!!

  • I guess Op is referring to disable the button in related list, not visualforce
    – Raul
    Nov 10, 2017 at 8:22
  • 1
    @RahulSharma: Yes I'm referring to disable the button in the related list.
    – jema
    Nov 10, 2017 at 8:25
  • @jema Have updated the answer. You can try the same and let me know this works! Nov 10, 2017 at 8:51
  • @KhushbooDua: Hi, will try this :). But one thing concerns me, on-click javascripts will not be supported in lightning. Nonetheless, I'll update you if it works.
    – jema
    Nov 10, 2017 at 9:03

You must log in to answer this question.

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