function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
fgwarb_devfgwarb_dev 

Apex+VF = Duplicate / Triplicate record creation...?

We've had this happening for awhile, but it's now just started to spread to other systems.

 

We have VF buttons that execute Apex actions which result in record creation.  Sometimes (un-reproducably), a user clicking on a button will result on the Apex Action firing multiple times, creating duplicate or triplicate records.

 

From all of the testing and research that's been done my best guess is that it's a latency/lag issue.  Maybe the browser is POSTing the form until it gets a ACK from Salesforce, and Salesforce is receiving the POSTs but the ACKs aren't making it back to the browser in time???

 

If you can't tell, I'm grasping at straws.  I've posted no code, because of the time I've personally spent digging through it I've found nothing.  HELP???

Ritesh AswaneyRitesh Aswaney

I'd be surprised if that was the case, unless the user was clicking the button multiple times.

 

A way to get around this would be some sort of de-dupe check before the record is inserted such as using an external id on the record and using the upsert operation, rather than an insert.