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

Question

Question

Need to remove some annotations but not all

asked on January 12

Hello Everyone, 

I have a use case that I need help with. We have HR documents that get annotation added to them. My folks are adding text boxes, stamps, highlights, and sticky notes. They are using Laserfiche to its full extent. The issue comes up when they need to fax or email the documents. The highlights and sticky notes are internally needed but the stamps and text boxes are a true modification to the document. So what happens is that they need to send the document with the stamps and text boxes still on it, but remove the highlights and sticky notes. 

The options only give these possible choices. 

So they can remove the sticky notes, but then stamps, highlights, and sticky notes get grouped together in "Other Annotations". 

I found some posts about using a script to delete all annotations with workflow but I can't get them to work. Ideally, I would like to build a Workflow that kicks off on a document and removes just the annotation types I want, and leaves the rest. If the options part of printing gave more choices, then I wouldn't need this workflow but I have no idea if Laserfiche will ever update this part of the software. 

Thank you for the help.  

0 0

Answer

SELECTED ANSWER
replied on January 12 Show version history
  1. Create a New Workflow.  Set it to be a business process.
  2. Add a "Move Entry" activity to the Workflow.
    1. Rename it to "Copy Entry".
    2. Select "Copy" and "Starting Entry".
    3. Set the Destination to "%(Entry Path)".
  3. Add a "Rename Entry" activity to the Workflow.
    1. Set it to use the "OutputEntry" from the "Copy Entry" activity.
    2. Set the new name to: "%(Entry Name) (COPY) - Created by: %(Initiator) - Timestamp: %(DateTime)"
  4. Add an "SDK Script" activity to the Workflow.
    1. Rename it to "Remove Highlighting".
    2. Set it to use the "OutputEntry" from the "Rename Entry" activity.
    3. Select "C#.NET" as the scripting language.
    4. Here's the full script:
      namespace WorkflowActivity.Scripting.RemoveHighlighting
      {
          using System;
          using System.Collections.Generic;
          using System.ComponentModel;
          using System.Data;
          using System.Data.SqlClient;
          using System.Text;
          using Laserfiche.RepositoryAccess;
      
          /// <summary>
          /// Provides one or more methods that can be run when the workflow scripting activity is performed.
          /// </summary>
          public class Script1 : RAScriptClass104
          {
              protected override void Execute()
              {
                  using (DocumentInfo di = new DocumentInfo(BoundEntryId,RASession))
                  {
                      List<AnnotationBase> anns = (List<AnnotationBase>)di.GetAnnotations();
                      foreach(AnnotationBase ann in anns)
                      {
                          if (ann.AnnotationType == AnnotationType.Highlight) Annotation.Delete(ann.EntryId,ann.PageNumber,ann.ItemId,RASession);
                      }
                      di.Save();
                  }
              }
          }
      }
    5. Add an "SDK Script" activity to the Workflow.
      1. Rename it to "Remove Sticky Notes".
      2. Set it to use the "OutputEntry" from the "Rename Entry" activity.
      3. Select "C#.NET" as the scripting language.
      4. Use the same script as the last item, but change line #23 to use "AnnotationType.Note" instead of "AnnotationType.Highlight".

 

Here's a document I made to test, with several annotations added in the Windows Client:

 

And here's the copy made by the Business Process Workflow (with the highlighting and sticky notes removed - but the stamps and redactions still in place):

 

I borrowed from this post for the script.

1 0
replied on January 12

This looks great! I had started the workflow exactly like you explained, I just couldn't get the dang code to work. I'll give this a try. Your step-by-step instruction is exactly what I needed!

1 0
replied on January 12

Yeah, it can be really hard to work from just short snippets of code if you are not familiar with coding or how Workflow utilizes the code.

Note that the class inheritence on line 14 of the code (where it says "RAScriptClass104") assumes you are in Workflow 10.4 - if you're on a different version of Workflow, the script will inherit a different class - so pay attention to what is shown there when you first open the SDK Script activity.

0 0
replied on January 12

Yeah, I'm on 10.4.

And it works perfectly!!! Thank you so much, Matthew!

1 0
replied on January 12

That's great news!

1 0

Replies

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

Sign in to reply to this post.