Run script when object is cloned?


I’ve added scripting (on ‘create’ and ‘update’) to assign a GUID when my schema’s existing ‘guid’ fields are blank or null. This is working great.

The problem is that when authors clone objects (which they do frequently), the cloned object has the same guid values as the original. This obviously defeats the purpose of a GUID.

I’m wondering if, (a) there’s a way to run a script during the clone operation so that I can assign new GUIDs to the clone at that time, or (b) a way for my create/update script to detect that the object is a clone, so that it can assign new GUIDs values (but only once) when the cloned object is saved, or © some other solution I haven’t considered.

Another approach would be for me to add a button to the editor such that when the button is clicked a script is run that generates new GUID values. Is this possible?

Any help would be greatly appreciated!


A clone is just a create. If you create new guids always (even if a guid has been defined) it should just work.

Ah, okay. So my create script should create new GUIDs whether or not they already exist.

(We want the GUIDs to be stable over time, so my update script will still only create GUIDs if the field is null or blank.)

Thanks very much!

I would create a “create-script” instead.