Hi Dynamics community ,
one of my colleague create an new custom entity call related service rentals in CRM 2016 which has look up field to Quote . Also this new custom entity has a another look up field call service rental. now what he wants to do is add list of service rentals to the Quote . so when we go add new related service rental it automatically populate quote we need to filter the look up for service rentals which belong to same customer as Quote.
does this make sense ?
I am trying to read Quote custome id from SDK REST and then use that customerid to filter the look up for related service rental so it's easy for user to find the record.
I have found this post about filtering look up http://www.inogic.com/blog/2015/08/apply-custom-filter-on-lookup-field-in-dynamic-crm-using-script/
but I am failing to get customer id from linked quote.
this what i tried and I get Unable to get property 'id' of undefined or null reference error
var quotelookup = Xrm.Page.getAttribute("new_relatedquoteid").getValue(); if (quotelookup != null) { var quoteid = quotelookup[0].id; SDK.REST.retrieveRecord( quoteid, "Quote", "CustomerId", null, function (quote) { var customerlookup = quote.CustomerId; if (customerlookup != null && customerlookup != undefined) { var customerid = customerlookup[0].id; alert(customerlookup + customerid); } else { alert("undefined customer"); } }, errorHandler ); }
any idea how to approach this please ?