1

We all know that there is 1:N relation between quote and quote product. And there is a field in quote product named quoteid, I mean this Now I want to code a JavaScript in Quote Product Form that need Quote ID. I want to put quoteid field (that is a reference to the primary related quote) into the form. But I can not see this field(quoteid) in the form fields, like this The quoteid field is not listed in the All fields, and If I want to create new lookup field, It creates new 1:N relation and I dont want this. I tried another way to get Quote Id by calling a REST, in this way :

The quoteid field is not listed in the All fields, and If I want to create new lookup field, It creates new 1:N relation and I dont want this. I tried another way to get Quote Id by calling a REST, in this way :

var quoteProductGUID=Xrm.Page.data.entity.getId();
var firstReq = new XMLHttpRequest();
firstReq.open("GET", Xrm.Page.context.getClientUrl() + 
"/XRMService/2011/OrganizationData.svc /QuoteDetailSet(guid'"+quoteProductGUID+"')?$select=QuoteId", true);

firstReq.setRequestHeader("Accept", "application/json");
firstReq.setRequestHeader("Content-Type", "application/json;    charset=utf-8");
firstReq.onreadystatechange = function() {
if (this.readyState === 4) {
    this.onreadystatechange = null;
    if (this.status === 200) {
        var result = JSON.parse(this.responseText).d;
        var quoteId = result.QuoteId;
        quoteId=quoteId.Id;

    } else {
        alert(this.statusText);
    }
   }
 };
firstReq.send();
}

But it needs the quote product Id and when It has not created yet, It can not get the quote product Id. So the question is how can I display quoteid field that already exist in the form.

0 Answers0