How do I get the selected Item Content?

When I place [0] in ar partListId = partList[0].childNodes[0].getAttribute("id"); I get the FIRST item in the relationship and if I put ( [1],[2], etc  I get the next items in the list) What do I need to do to get the active (selected) item for the child instead of placing a number.

var partList = inArgs.itemContext.getElementsByTagName("Relationships");
var partListId = partList[0].childNodes[0].getAttribute("id");

var item = this.newItem("min_procure_list","get");
item.setProperty("id",partListId);
var res = item.Apply();
cIdentity = res.getPropertyAttribute("related_id","keyed_name");
alert("Part Name:" + cIdentity);

  • Hi Ddidonato

    You can get the selected item ids using below code. You can iterate over the result and get the related items.

    var topwindow = top.aras.getMostTopWindowWithAras(window);
    var relationship = topwindow.relationships;
    var currentTabId = relationship.currTabID;
    var relationshipsGrid = relationship.iframesCollection[currentTabId].contentWindow.grid;
    var relationshipType = aras.getRelationshipTypeName(currentTabId);
    var idListIds = relationshipsGrid.getSelectedItemIds();
    var item = this.newItem("min_procure_list","get");
    item.setAttribute("idlist",idListIds.join(','));
    var res = item.Apply();