Forum Discussion
We did not add any server events on any types, the OOTB events already exist on our Poly type.
Is there anything else we need to do?
Hi,
Just to make sure I understand correctly:
- You trigger an Action.
- The Action calls a server Method.
- The Method adds an ItemType as a Poly Source to your Poly ItemType.
If that's the case, a few things come to mind.
First, adding an ItemType to the Poly Sources relationship programmatically does not necessarily execute all of the logic that is triggered when the same operation is performed through the standard ItemType editor.
Some server events or internal framework logic may be skipped, which can lead to unexpected results even though the resulting database records appear identical.
May I ask what the purpose is behind having an action for administrators to add ItemTypes as Poly Sources?
For example, is the method also creating properties, relationships, or other configuration that links the Poly ItemType to the newly added source ItemType?
As you may know, properties defined on a Poly ItemType are expected to be available on the ItemTypes used as Poly Sources. Is your method also creating or validating those properties? If that logic is normally performed when configuring the Poly Source manually, it may be getting skipped when the relationship is created programmatically.
Regarding the "Restricted" entries, from my experience the most common causes are:
- The current user does not have permission to discover or get the referenced item.
- The related item cannot be resolved correctly, even though the relationship record exists (for example, an incorrect related_id).
Since you mentioned that the database entries are identical and that assigning World permissions did not help, I would investigate whether an additional metadata refresh, cache refresh, or server restart is required after adding the Poly Source relationship programmatically.
If you manually add the same ItemType as a Poly Source, save it, and then compare the resulting records (including any related metadata tables) with the programmatically created version, do you see any differences at all?