Forum Discussion

Former_Member's avatar
Former_Member
Accelerator III
8 years ago

Get related items on form load event

Hello, im trying to get the related items of an item on its form load event. The code im using looks like this :
var item = document.thisItem; var related_items = aras.getRelationships(item.node, "MY_RELATIONSHIP");
but if the Relationship grid hasnt been loaded before the related_items is empty, is there a way to force load the Relationship grid before trying to retrieve the related items? Thank you. Léo

4 Replies

  • try
    item.fetchRelationships("MY_RELATIONSHIP")
    var related_items = item.fetchRelationships("MY_RELATIONSHIP")
     
  • I realise I made a mistake :) use get in the second line, I guess you figured it out.
    item.fetchRelationships("MY_RELATIONSHIP")
    var related_items = item.getRelationships("MY_RELATIONSHIP")
  • Indeed :p , I should have specified that i changed your code to make it work ! Thanks again!