Skip to main content
Inspiring
January 5, 2011
Question

deleting crossreferences when content is deleted

  • January 5, 2011
  • 1 reply
  • 553 views

in my workflow i need to delete some content, content that is crossreferenced later in a table. i'm stuck on how i can delete the crossreferences to this content if/when i delete the content. i can think of a few options, but yet, not sure how to implement them:

a) if possible, on a save event, check the content and look for dead crossreferences and delete

b) create a script that needs to be run that does the above

c) when content is deleted, the cross reference is also deleted

one of a) or c) would be preferable as it would be automatic, though i'm not yet sure how to go about it. could anyone give me pointers please?

thanks

This topic has been closed for replies.

1 reply

Harbs.
Legend
January 5, 2011

In CS5, it might be technically possible to do c), but I would not advise it.

a) is doable, but you should start with b) and then you can run the script in an event handler once it's working correctly.

To run it in an event handler you'd make a startup script with a persistent engine which adds an event listener which runs your function.

Harbs

Inspiring
January 5, 2011

I'm comparing the length of doc.crossReferenceSources.length against doc.hyperlinkTextDestinations.length, and if they're not equal, then that hints at a dead reference in my document, so i'm trying to then cycle over the crossReferenceSource's (there's one more than hyperlinktextdestination's), but all crossreferencesource's seem to be have isValid set to true even though the destination is gone, and the cross-reference tab in id shows a dead cross reference.

Why?

Inspiring
January 5, 2011

interesting. i've been cycling over doc.hyperlinks, and even though all have .isValid == true on them all, the dead links have destination == null. surely that's a bug as any hyperlink that has hyperlink.destination == null is not valid.