Triggering Record Mods

Making parent records look modified when you're only changing child records.

Even though GoZync asks you to add a modification timestamp field to every table, GoZync looks at the modification time of the parent record (or primary TO) to see if the entity as a whole has been modified.

(Not sure when we mean by "entity"? Check the glossary.)

This means that if you're only changing the quantity on an invoice line item, for example, you'll need to somehow modify the parent record (the invoice) as well, in order for GoZync to pickup that change.

Fortunately, script triggers make this pretty simple. Here is a very simple an effective way to do this.

1. Create a script that sets the field "gz_ModTimeStamp" in your primary TO (invoices, in this example) to 1. (This simply triggers the field's auto enter option; the value won't actually be 1).
2. On the layout where you edit invoices (NOT your sync layout--as that can't have script triggers on it) add a layout level script trigger "On Record Commit" which calls the script you wrote in 1 above.

You'll see just such a script trigger on the Work Orders layouts in our WorxMobile example. The script we call is named "Mod On Commit" and it's wonderfully short. Feel free to copy and paste that into your file and point it at your "gz_ModTimeStamp" field.

Now, whenever you edit data in any portal on this layout, the script will set the invoice's mod timestamp as soon as any of the related records are committed. (Note that this only works for changes made ON this layout: if you're editing related records elsewhere, you'll need to script those edits to change their parents' mod timestamp as well.)