You are viewing limited content. For full access, please sign in.

Question

Question

Creating a workflow that can remove annotations from previous documents?

asked on May 10, 2024 Show version history

Working with a client and they wanted to see if there was any way to create a workflow that could go through a folder find all the documents with annotations, remove them and refile them back to the exact location. 

Looking at the annotation activity I am seeing that it does not do what I was actually thinking by removing annotations as I was expecting. Curious if there is a way to make a workflow that could do this.

 

So my biggest question is this possible and if so can anyone share any useful pointers.

 

Thank you!

 

2024-05-10 15_19_17-Support Laserfiche 11 - CloudShare.png
0 0

Replies

replied on May 10, 2024

You can remove annotations with an SDK Script in Workflow.

Note that this would remove all annotations, including stamps and such, but it doesn't take much to add checks so it would only remove specific types of annotations.

            bool removed = false;

            try {
                // get document
                using (DocumentInfo doc = (DocumentInfo)this.BoundEntryInfo){
                    // iterate and remove annotations
                    foreach(AnnotationBase ann in doc.GetAnnotations()){
                        // delete annotation
                        Annotation.Delete(ann.EntryId,ann.PageNumber,ann.ItemId,RASession);
                    }

                    // save changes
                    doc.Save();

                    // set success
                    removed = true;
                }
            }
            finally {
                // set results
                SetTokenValue("Removed",removed);
            }

The try-finally is there to catch errors and ensure the output token is set.

In the Workflow, you pass the target entry as the Script's Default Entry, so in your example you'd put it inside the For Entry loop and pass it the Current Entry.

Then, after it runs you can check the "Removed" token to make sure it worked before moving on to the next step, retrying, etc.

On a side note, if your Move Entry is meant to move each document rather than the whole folder, make sure it is inside the loop and also targeting the Current Entry.

2 0
replied on May 10, 2024

Jason,

 

Thank you sir. Going to test this out and see if I can get it working correctly.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.