Community
Showing results for 
Search instead for 
Do you mean 
Reply

Thoughts on how to avoid duplicates when two syncing remote databases are creating File Numbers sequentially?

Copper Contributor
Posts: 123
Country: Canada

Thoughts on how to avoid duplicates when two syncing remote databases are creating File Numbers sequentially?

I have an issue that I'm hoping someone else has seen before or could shed some light on.

 

Our database has Group Entities which represent a File #.
The name of each group is the File #.
We use the SDK for this CRM to create the next available File #.

 

Essentially it works like this:

  • we have a boolean field which is set to True for the Last Created File #
  • the user clicks the "Create Next File #" button when they want to create a new File.
  • a function runs that gets the name of the File # which has the Last Created File field set to True
  • it adds 1 to that File # and creates a new File #.
  • then it sets the Last Create File field to false on the previous # and sets the field to True on the newly created File #

This part works fine and does things like duplicate checking etc which is not relevant for my issue.

The issue for us is that we have introduced a Remote database which has the same functionality and it syncs with out main database.

 

Now there is the opportunity for duplicate File #'s to be created if the Remote Database has not synced yet.

I would trigger a sync to happen on the Remote database before the function mentioned above happens but it does take a long time and they would also have to sync again after the function has ran which would eat up too much time for the user.

 

We were thinking for a quick workaround that we would create a similar field for the Remote Database and give a block of File #'s for that Remote database to create but I feel like there must be a better way to achieve this.

 

Anyone have any suggestions on a better method? Apparently doing away with the Remote Database is not an option unfortunately.