There are four scripts in the RESTfmSync sample file :
Copy and paste all of the scripts into your local copy of your solution.
This is the main script that you call to begin the sync process.
At the beginning of the script there is a
$configuration variable used to setup the server parameters. The only critical changes are to the Server, and account details. If you've copied the naming conventions and used default install details, everything else will be as per the defaults.
There is a looping function that needs to be performed once for each table being synced. Duplicate the script steps :
For each Perform Script step there is a parameter that does a GetField on the ID field of that table. You need to adjust the parameter for each Table that is being synced to refer to the ID field of that table.
Other parameters can be adjusted to configure table-specific behaviour. See the comments within the Script Parameter for details.
As well, at the end of the script is a process that shows a dialog on error or success. This can also be modified as required. Error 1631 is a general "Connection failed" error so we recommend that you adjust the script for those errors and show a "try again" error as network connections can occur.
This is the script that does all the work. The entire script uses the setup parameters specified in the Main script so that there is no coding change required. For new releases of the RESTfm code, just replace this entire script's contents.
This script is a sample of how you'd handle a scripted delete in a synchronised data model.
When using RESTfmSync, if the "SyncUTC" field is empty, then the record has never been synced and can be deleted. Otherwise we add the field ID details to a field in the RESTfm table, and on the next sync, the record will be marked as deleted on the server.
You need to adapt this script to handle the delete for your records and for your own setup ( portal deletes vs record delete, cascading deletes etc ) and make sure that the process to manage these is incorporated into the solution user interface.
Update Old Sync
This script is used for compatibility with older versions of RESTfmSync prior to v3. If you're not updating, or have replaced old code you can delete this script.
Once this is done, the setup is complete and you can call the "Main" script to start the sync process.