0

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

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!!

|improve this answer|||||
  • I guess Op is referring to disable the button in related list, not visualforce – Raul Nov 10 '17 at 8:22
  • 1
    @RahulSharma: Yes I'm referring to disable the button in the related list. – jema Nov 10 '17 at 8:25
  • @jema Have updated the answer. You can try the same and let me know this works! – Khushboo Dua Nov 10 '17 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 '17 at 9:03

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.