Posts

Showing posts with the label jQuery

Perform logic on change of DateTime field

 Writing business logic on change of DateTime field in CRM portal using jQuery is different than normal on change function. eg. If we want to check whether entered date is in past or not then we will use following syntax :  In our case Start Date is the field where we are adding validation. Schema name for start date is new_startdate var dpcontrol = $("#new_startdate_datepicker_description").closest("div.control"); $(dpcontrol).on("dp.change", function (e) { var dateVal = $("#new_startdate").val(); if (dateVal != null) { var newDate = new Date(dateVal), now = new Date(); newDate.setHours(0,0,0,0); now.setHours(0,0,0,0); if (newDate

jQuery Basic Syntax

 In Microsoft D365, jQuery is mostly used in different CRM portal for development purpose. Providing basic syntax required to Get/Set field value in jQuery :  1. TextField :  var firstname = $("#firstname").val();  //get var lastname = $("#lastname").val("Tendulkar");  //set  2. OptionSet :  var type = $("#typecode").val(); //get var type = $("#typecode").val(16350000);  //set (enter code of optionset field) 3. Lookup :  //Get Lookup Value var lookupGUID = $(“#new_accountid”).val(); var lookupValue = $(“#new_ accountid_name”).val(); var entityName= $(“#new_accountid_entityname”).val(); //set Lookup Value $(“#new_accountid”).val(lookupId); $(“#new_accountid_name”).val(lookupName); $(“# new_accountid_entityname”).val(EntitySchemaName); 4. CheckBox :  //Get Checkbox value var isChecked = $(“#{field_name}”).is(“:checked”); if (isChecked == true) { alert(“Checked!”); } else if (isChecked == false) { alert(“Unchecke...