cancel
Showing results for 
Search instead for 
Did you mean: 

Find updated document

Atit_Patel
Champ in-the-making
Champ in-the-making

Is there a way to find the last modified time of the document? I need to search all the documents for which the keywords are updated either by reindex or by the workflow.

3 REPLIES 3

Seth_Yantiss
Star Collaborator
Star Collaborator

Atit,

I might have a solution, but I need to ask a few questions first:

  1. Are you looking for the latest modification to a keyword?
  2. Are you looking for the latest modification to a document?
  3. Does the document type matter? (eg. are you looking for the latest modification to a specific document type?)
  4. Are you looking for the most recent view of a document, the most recent "re-index" of a document, or something else?
Cheers,
Seth 

Seth_Yantiss
Star Collaborator
Star Collaborator

Oh, Also...  Do you have the OnBase Reporting module?

Joe_Kocsis
Confirmed Champ
Confirmed Champ

Atit,

Thanks for your question!  You can access the document history using the DocumentHistory and DocumentHistoryItem classes.  If you are looking to get the last time a document was modified by a keyword change, you can do the following:

Get the document history of the document in question, iterate through the DocumentHistoryItems and look for an action that contains 'Keyword' using a regular expression (**Note** you want to look for 'keyword', not 'keywords'.  If you look for 'keywords' you will get results like "Viewed Keywords" which you dont want), and then get the LogDate of that DocumentHistoryItem.  When you retrieve the DocumentHistory for a document, the most recent item is the first returned, so i did a quick counter to only get the first item that matches 'keyword'.

**EDIT**  When a document is re-indexed, and the document type changes, it will log "Document Re-Indexed" so you could use the regex to evaluate for this as well.

This is what my test looks like:

Document doc = u_app.Core.GetDocumentByID(1234); DocumentHistory docHistory = doc.GetHistory();int i = 0;            foreach (DocumentHistoryItem docHisItem in docHistory){     while (i < 1)     {          if (Regex.IsMatch(docHisItem.Action, @"\bKeyword\b"))          {               //Do Work               i++;          }     }}