Hi all,
i am trying to understand behavior of server events attached to an Itemtype,
Hi all,
i am trying to understand behavior of server events attached to an Itemtype,
Hi Lokesh,
Your understanding is incorrect in a couple ways. The AML query that would run when you get your Part with the 25 documents attached looks something like this.
<AML>
<Item type="Part" action="get" id="YOUR_PART_ID">
<Relationships>
<Item type="Part Document" action="get">
<related_id>
<Item type="Document" action="get"></Item>
</related_id>
</Item>
</Relationships>
</Item>
</AML>
As you can see in this example, there's only one actual Get request being made for the Document ItemType, so the onBeforeGet server event is only called once.
Additionally, the onBeforeGet server event might not be the one you're actually looking for. onBeforeGet events are run before the query to the server is actually made. Because of this, they are usually used for query validation like making sure that some filter is always applied when a get request is run.
Based on the name of the method you're running, it sounds like you're trying to modify the data before it's returned to the user. This would best be done in an onAfterGet event which is used for data validation on the items that are returned to the database.
Could you also further clarify your overall use case? There might be an alternative way that's better than using a server event at all.
Chris
Christopher Gillis
Aras Labs Software Engineer