Deletes

How does GoZync handle deleted records?

Records deleted in the hosted file are deleted from the mobile file the next time the mobile device pulls that table or executes a round-trip sync.

Records deleted in the mobile file are not automatically deleted from the hosted file when synced. If you want them to be, create a new flag field called "deleted" in both the mobile and hosted files. Add that field to your sync layouts in GoZyncMobile so it syncs. Then set up a server-side script that periodically finds and deleted those records marked "deleted" field = "1" in the hosted file. Once deleted in the hosted file, those records will be permanently deleted from the mobile file on the next sync.

Deleting records that don't (no longer) belong to me (this is awesome)

A record doesn't actually have to be deleted from the host / server to be deleted from the user's mobile device: the record would also be removed from the user's device if it no longer "belongs" to that user.

For example, let's say that you've scripted GoZync to only pull down your orders that are marked "Ready". And that when you push those records back to the server, you're using our Custom Field Mapping script to mark the record "Completed."

Well, next time that mobile user pulls down records, they'll also pull a list of all the orders they are supposed to have on the device: any records not on that list (because they were deleted from the host or because they are no longer "ready") will be deleted from the user's device. This makes it very easy to craft workflows where the user only has the records they need: you build a found set of records appropriate for that user, and GoZync does the rest. (This is awesome.)

Here are some more examples of how deletes can really help with your workflow...

Let's say I'm a home health care aide and each morning I sync down to my iPad the half dozen or so patients I need to visit that day. So on Monday I get 6 patient records on my iPad.
If I have  GoMaps I know just where they are, but that's another story =)
At the end of the day I sync my visit notes back up to the hosted files. Now one of the patients I saw on Monday, Beth, called up to the office an needs something else, so the folks at the office assigned me to visit her again tomorrow.
So on Tuesday morning I sync again and the  filter in GoZync pulls down just the people I'm assigned to see on Tuesday. Since Beth is on my list for Tuesday, she stays on my iPad and gets some new notes from the office. The other 5 people I saw on Monday no longer match my filter criteria ("folks assigned to me for Monday") so they're deleted from my iPad and replaced with my Tuesday patients.
And if another aide calls in sick and the office has to assign two of their patients to me as well, all I have to do is sync again and I have those two new patients as well. Both of which will be deleted from my iPad when they no longer match my day's assignment.
GoZync handles all of this: deleting any records on your mobile device that no longer match your filter criteria.

Turning Off Deletion

If you want to manage the deletion of mobile records yourself, you can turn off GoZync's management of it. This can make some syncs faster as GoZync won't be building a list of all the IDs that should be on the mobile device.

1. Add an "Exit Script" line at the beginning of the script "Delete Records Not In This List ( $IDsToKeep )" in GoZyncMobile.

2. Edit the script "Get IDS Needed For Sync PSOS" in your hosted file and disable the block of lines beginning with the first instance of the comment "gather IDS" (about line 48) and ending with "end loop" (about line 91).

3. The right after that end loop you just disabled above, add a line setting the variable $IDsToKeep to this:

List( 
$IDsToKeep ; 
"TOName=" & $TOName; 
"foo" 
)