Sunday, May 2, 2021

Updating Bullk Documents properties using Event Action Handler

Document Operations - Updating Document Properties with Folder Properties using EventActionHandler 


public class UpdateDocumentProperties implements EventActionHandler

{

@Override

public void onEvent(ObjectChangeEvent event, Id arg1) throws EngineRuntimeException 

{

try{  

ObjectStore os = event.getObjectStore();  

Id id = event.get_SourceObjectId(); System.out.println(" *Your Event Action Call Started *");  

Folder folder = Factory.Folder.fetchInstance(os, id, null);  

DocumentSet docList =  folder.get_ContainedDocuments();  

Iterator docItr = docList.iterator();  

while (docItr.hasNext() )

{  

Document doc = (Document) docItr.next(); doc.getProperties().putValue("Your_SymbolicName", folder.getProperties().get("Your_SymbolicName").getInteger32Value()); doc.getProperties().putValue("Your_SymbolicName", folder.getProperties().get("Your_SymbolicName").getStringValue()); doc.getProperties().putValue("Your_SymbolicName", folder.getProperties().get("Your_SymbolicName").getDateTimeValue()); doc.save(RefreshMode.NO_REFRESH); 
}catch(Exception e){
  e.printStackTrace(); 

}
}
 }