function CalculateOpportunityProductQuantity(executionContext) { var formContext = executionContext.getFormContext(); var opportunityRecordId = formContext.data.entity.getId().slice(1, -1); var globalContext = Xrm.Utility.getGlobalContext(); // Retrive unitwise product quantity data var fetchXml = "<fetch mapping='logical' >" + "<entity name= 'opportunity' >"+ "<link-entity name='opportunityproduct' from='opportunityid' to='opportunityid' alias='opportunityprod' >"+ "<attribute name='quantity' />"+ "<filter>"+ "<condition attribute='opportunityid' operator= 'eq' value='" + opportunityRecordId + "' uiname='Will be ordering' uitype='opportunity' />"+ "</filter...
Work smarter, not harder.