Hi,
What is the easier way to get the source item' s property value on the related item?
For ex: ItemTpye1(source item) has a field and a relationship, where Itemtype2 is the related item. Itemtype2 has a field. I can only 'Create Related' from Source Item. When I create a related item and save then its field should get the same value what source item' s field have.
For this I have created a ServerEvent and added under Itemtype2 with OnBeforeAdd. The way I tried is, I added a property on Relationship Itemtype data typed as Foreign pointing to SourceItem' s property. And I' m setting this property value to the related item's field.
Dim id As String = Me.getID()
Dim relitem As Item = inn.newItem("RelationshipItem","get")
relitem.setAttribute("where","[RelationshipItem].related_id = '"+id+"' ")
Dim res As Item = relitem.Apply()
Me.setProperty("stage_id",res.getProperty("test",""))
OnBeforeAdd it says 'Not A single Item' , OnBeforeUpdate it is working. Where I need to save the Source Item first to add the relationship and two times save of related item.
Is there any other best way of doing this?
Thank You