diff --git a/server/core/src/storage.ts b/server/core/src/storage.ts
index fb16c3e63b..22bc5da41a 100644
--- a/server/core/src/storage.ts
+++ b/server/core/src/storage.ts
@@ -130,7 +130,7 @@ class TServerStorage implements ServerStorage {
       // store object
       await this.routeTx(tx)
       // invoke triggers and store derived objects
-      const derived = await this.triggers.apply(tx.modifiedBy, tx, this.findAll.bind(this))
+      const derived = await this.triggers.apply(tx.modifiedBy, tx, this.findAll.bind(this), this.hierarchy)
       for (const tx of derived) {
         await this.routeTx(tx)
       }
diff --git a/server/core/src/triggers.ts b/server/core/src/triggers.ts
index 8340841f28..402c83e51f 100644
--- a/server/core/src/triggers.ts
+++ b/server/core/src/triggers.ts
@@ -14,7 +14,7 @@
 // limitations under the License.
 //
 
-import type { Tx, Doc, TxCreateDoc, Ref, Account } from '@anticrm/core'
+import type { Tx, Doc, TxCreateDoc, Ref, Account, Hierarchy } from '@anticrm/core'
 import core, { TxFactory } from '@anticrm/core'
 
 import { getResource } from '@anticrm/platform'
@@ -39,8 +39,8 @@ export class Triggers {
     }
   }
 
-  async apply (account: Ref<Account>, tx: Tx, findAll: FindAll<Doc>): Promise<Tx[]> {
-    const derived = this.triggers.map(trigger => trigger(tx, new TxFactory(account), findAll))
+  async apply (account: Ref<Account>, tx: Tx, findAll: FindAll<Doc>, hierarchy: Hierarchy): Promise<Tx[]> {
+    const derived = this.triggers.map(trigger => trigger(tx, new TxFactory(account), findAll, hierarchy))
     const result = await Promise.all(derived)
     return result.flatMap(x => x)
   }
diff --git a/server/core/src/types.ts b/server/core/src/types.ts
index e3080b85e4..5f15993bc6 100644
--- a/server/core/src/types.ts
+++ b/server/core/src/types.ts
@@ -15,7 +15,7 @@
 //
 
 import type { Tx, Ref, Doc, Class, Space, Timestamp, Account, FindResult, DocumentQuery, FindOptions } from '@anticrm/core'
-import { TxFactory } from '@anticrm/core'
+import { TxFactory, Hierarchy } from '@anticrm/core'
 import type { Resource } from '@anticrm/platform'
 
 /**
@@ -26,7 +26,7 @@ export type FindAll<T extends Doc> = (clazz: Ref<Class<T>>, query: DocumentQuery
 /**
  * @public
  */
-export type TriggerFunc = (tx: Tx, txFactory: TxFactory, findAll: FindAll<Doc>) => Promise<Tx[]>
+export type TriggerFunc = (tx: Tx, txFactory: TxFactory, findAll: FindAll<Doc>, hierarchy: Hierarchy) => Promise<Tx[]>
 
 /**
  * @public
diff --git a/server/view-resources/src/index.ts b/server/view-resources/src/index.ts
index 83c5c0872a..65e7961502 100644
--- a/server/view-resources/src/index.ts
+++ b/server/view-resources/src/index.ts
@@ -14,23 +14,21 @@
 // limitations under the License.
 //
 
-import type { Tx, TxFactory } from '@anticrm/core'
+import type { Tx, TxFactory, Doc, TxCreateDoc, DocWithState } from '@anticrm/core'
+import type { FindAll } from '@anticrm/server-core'
 
-// import core from '@anticrm/core'
+import core, { Hierarchy } from '@anticrm/core'
 
 /**
  * @public
  */
-export async function OnDocWithState (tx: Tx, txFactory: TxFactory): Promise<Tx[]> {
-  // if (tx._class === core.class.TxCreateDoc) {
-  //   const createTx = tx as TxCreateDoc<Message>
-  //   if (createTx.objectClass === chunter.class.Message) {
-  //     const content = createTx.attributes.content
-  //     const backlinks = getBacklinks(createTx.objectId, content)
-  //     return backlinks.map(backlink => txFactory.createTxCreateDoc(chunter.class.Backlink, chunter.space.Backlinks, backlink))
-  //   }
-  // }
-  console.log('OnDocWithState here')
+export async function OnDocWithState (tx: Tx, txFactory: TxFactory, findAll: FindAll<Doc>, hierarchy: Hierarchy): Promise<Tx[]> {
+  if (tx._class === core.class.TxCreateDoc) {
+    const createTx = tx as TxCreateDoc<DocWithState>
+    if (hierarchy.isDerived(createTx.objectClass, core.class.DocWithState)) {
+      console.log('OnDocWithState derived here')
+    }
+  }
   return []
 }