Hi,
I have a requirement to change the display of lookup fields displayed in the subgrid(related entity) shown on an entity form to hyper links.
I have followed the below blog which he has done it for entity list, in my case it is subgrid.
http://arpitmscrmhunt.blogspot.com/2017/08/hyperlink-on-lookup-values-in-crm-portal.html
Here is my code, i could find the table,th(header) but not the td, i think as it is getting loaded in async after the whole document is loaded, so the function is not getting executed.
<script type="text/javascript"> debugger $('document').ready(function () { debugger $('#EntityFormControl_EntityFormView').ready(function () { //To make the other field/column's value hyperlink $("table[role='grid']").find("td[data-attribute='qtq_shipment']").each(function () { // it is not entering this function. //$("td[data-attribute='qtq_shipment']").each(function () { debugger var id = $(this).attr("data-value"); var attrList = id.split(","); if (attrList.length > 0) { var idAttr = attrList[0].split(":"); var recordId = idAttr[1]; recordId = recordId.replace('"', ''); recordId = recordId.replace('"', ''); // Partial URL of webpage where you want to redirect the user or the page from which your Edit Entity Form is associated var pagewhereToRedirect = "/shipments/shipment-details"; //var pagewhereToRedirect = "edit-case"; // For Example // Construct the URL var redirect = window.location.href + pagewhereToRedirect + "/?id=" + recordId; // Make the field value Hyperlink var text = $(this).text(); $(this).html("<a href=" + redirect + ">" + text + "</a>"); } //}); }); }); }); </script>
I have tested the above code outside portal in a static html page with the html(for the subgrid div) taken from my portal page, it works fine.
Any thoughts please?