I have done lot of work using javascript in Dynamics 365 (CRM) / CRM Projects. During many routine tasks I always used to think about how to optimize my code?, so able to do more with less code. Therefore achieve code reuse-ability, extensiveness and object oriented style. In below Javascript technique I am trying to demonstrate this approach.
function Customer() { this.name = AWXRM.GetXRMAttributeGetVal("name"); this.custid = AWXRM.GetXRMAttributeGetVal("accountnumber"); this.address = AWXRM.GetXRMAttributeGetVal("wtr_plot"); this.customertype = AWXRM.GetXRMAttributeGetText("wtr_customertype"); this.cnic = AWXRM.GetXRMAttributeGetVal("wtr_cnic"); this.phone = AWXRM.GetXRMAttributeGetVal("telephone2"); this.cell = AWXRM.GetXRMAttributeGetVal("telephone1"); this.guid = Xrm.Page.data.entity.getId(); this.guidplan = this.guid.replace("{", ""); this.guidplan = this.guid.replace("}", ""); this.invoices = {}; this.invoices.invoicedetails = {}; } function OnSave(){ var customer = new Customer(); }
㉺㉼㉴㉳㉽㉾㈕㈔㈆㈅㈄㈄㈃㈁㈀㉤
Ali Hamza Wadood
Microsoft Dynamics CRM Developer | Software Engineer - Microsoft Technologies(Asp.Net, Asp.Net MVC)