Harsha - Thursday, August 23, 2012 6:54 AM:
Hi,
I have added a relationship between two Item types using a server side method in OnAfterAdd event.
Every time when I open the form of source Item Type(Where I have added a relationship tab of related Items) only one related Item is being created and added to that relationship tab. I want to create and add multiple related Items at a time. How is It possible?
The code I used to add a relationship is:
Dim Innovatornew As Innovator = Me.getInnovator()
Dim ID As String = Me.getID()
Dim sourceItem As Item = Innovatornew.newItem("Source Itemtype", "get")
sourceItem.setAttribute("id", ID)
sourceItem.setAttribute("select", "id,item_number,type")
sourceItem = sourceItem.apply()
Dim relationshipItem As Item= Me.newItem("Relationship","add")
relationshipItem.setProperty("source_id",Me.getID())
relationshipItem.setAttribute("select","source_id,related_id(id,item_number,type)")
Dim relatedItem As Item = relationshipItem.createRelatedItem("related Itemtype","add")
relatedItem.setProperty("item_id", Me.getProperty("item_id","" ))
relatedItem.setProperty("description", Me.getProperty("description",""))
relationshipItem = relationshipItem .apply()
If (relationshipItem .isError()) Then
Return relationshipItem
End If
How to add multiple related Items at a time.Please help me.
Thank You
Harsha