Display Relationship data in a form

Hello, I would like to create my custom print view for an Item, for that i created a form triggered on the print event, but i would like to display in addition of the regular fields of the item, all the related items from its relationships. Any ideas on how i can do that? Thank you. Léo
Parents
  • Hi Leo, That's odd that you're unable to see the embedded Gist. Regardless, I am including both a link to the gist below as well as the text of the code below that. https://gist.github.com/cgillis-aras/c1aa8a7d3696c6c2f8d3d4ff1ae54e37
    <script type="text/javascript">
        showRelatedItems = function() {
    		var part = document.thisItem;
    		var relationships = aras.getRelationships(part.node, "Part BOM");
    		var container = document.getElementById("relatedItemContainer");
    		for (var i = 0; i < relationships.length; i++)
    		{
    			var relItem = aras.getRelatedItem(relationships[i]);
    			var relItemNum = aras.getItemProperty(relItem, "item_number");	
    			var newDiv = document.createElement("div");
    			newDiv.setAttribute("class", "related_item");
    			newDiv.innerHTML = relItemNum;
    			container.appendChild(newDiv);
    		}
    	}
    window.addEventListener("load", showRelatedItems);
    </script>
    <div id="relatedItemContainer"></div>
    
Reply
  • Hi Leo, That's odd that you're unable to see the embedded Gist. Regardless, I am including both a link to the gist below as well as the text of the code below that. https://gist.github.com/cgillis-aras/c1aa8a7d3696c6c2f8d3d4ff1ae54e37
    <script type="text/javascript">
        showRelatedItems = function() {
    		var part = document.thisItem;
    		var relationships = aras.getRelationships(part.node, "Part BOM");
    		var container = document.getElementById("relatedItemContainer");
    		for (var i = 0; i < relationships.length; i++)
    		{
    			var relItem = aras.getRelatedItem(relationships[i]);
    			var relItemNum = aras.getItemProperty(relItem, "item_number");	
    			var newDiv = document.createElement("div");
    			newDiv.setAttribute("class", "related_item");
    			newDiv.innerHTML = relItemNum;
    			container.appendChild(newDiv);
    		}
    	}
    window.addEventListener("load", showRelatedItems);
    </script>
    <div id="relatedItemContainer"></div>
    
Children
No Data