JavaScript/ Jquery Reference for Microsoft Dynamics CRM Portal (formerly AdxStudio)

//Get value of field from current page
var name = $('#new_name').val();
//Find the checkbox value
//Get value of field from parent page
var WorkOrder = $('#msdyn_name'window.parent.document)[0].value;
//Get record id from url of parent page
var WOId = window.parent.location.href.substr(window.parent.location.href.indexOf("?id"+ 4);
//Get Picklist value from parent page
var Status = $($('#new_status'window.parent.document)[0]).find("option:selected").prop("value");
//Disable DateTime Field
//Disable Lookup
//Disable a field
//Disable all fields on form
$("form").each(function () {
//Hide field row
//Hide DateTime
//Hide Text Fields
//Hide Lookup Field
//Clear Text field
//Clear Date field value
$("#new_ddcenddate").datepicker({ dateFormat: 'dd,MM,yyyy' }).val('');
//set text field value
$('#new_name').val("aayush signh");
//Get Set lookup field value
var lookupId = $("#new_address1state").val();
var lookupName = $("#new_address1state_name").val();
var entityName = $("#new_address1state_entityname").val();
function setDateTime() {
    var roundTripFormat = "yyyy-MM-ddTHH:mm:ss.0000000\\Z";
    var a = new Date(); //new Date(starttime);
    a = a.addHours(-5);
    a = a.addMinutes(-30);
    a = new Date(moment(a).utc());
    var formatteddate = a.format(roundTripFormat);
    var date = getdatetime(new Date());
    $("#msdyn_timetopromised").datepicker({ dateFormat: 'dd,MM,yyyy' }).val(formatteddate);  // Actual value passing to crm
    $('input[aria-describedby="msdyn_timetopromised_description"]').val(date);  // For Display only on date field control
//Add Business Required Class
//Remove Business Required Class
function getdatetime(dt) {
    var res = "";
    res += dt.getMonth() + 1;
    res += "/";
    res += dt.getDate();
    res += "/";
    res += dt.getFullYear();
    res += " ";
    res += dt.getHours() > 12 ? dt.getHours() - 12 : dt.getHours();
    res += ":";
    res += formatdigits(dt.getMinutes());
    res += " " + dt.getHours() > 11 ? " PM" : " AM";
    return res;
function formatdigits(val) {
    val = val.toString();
    return val.length == 1 ? "0" + val : val;
//Change label text on load of form
$(document).ready(function () {
    $('#new_name_label').text("Please enter customer's full name");
//Hide Section
//Show Section
//Hide option from Picklist
$("#new_status option[value='100000002']").hide();
//Clear Picklist Options
$("#new_status option").remove();
//Add Options in Picklist
$('#new_status').append($('<option>', { value: "10000001", text: "Option-1" }));
//Get the selected picklist Text value
$("#msdyn_workordertype option:selected").text();
//Append blank value to a picklist
$("#new_product").prepend("<option value=''></option>");
//set Picklist value by text
$('#new_status option:contains("' + StatusName + '")').attr("selected""selected");
//Hide Tab
function HideTab(sectionname) {
    var tab = $('table[data-name="' + sectionname + '"]').closest('.tab');
    var label = tab.prev('.tab-title');
//Show tab
function Showtab(sectionname) {
    var tab = $('table[data-name="' + sectionname + '"]').closest('.tab');
    var label = tab.prev('.tab-title');;;
//Hide button based on class name
var x = $(this).context.getElementsByClassName("workflow-link btn-default btn");
var i;
for (i = 0; i < x.length; i++) {
    x[i].style.display = "none";
//Get Today-x days date value
var BackDate = new Date(Date.parse(new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate() - 3)));


Popular posts from this blog

Search data in Gridview on Textbox Key press event using JQuery in Asp.Net- C#

StateCode and StatusCode Values for mostly used entities in Microsoft Dynamics CRM 2013

Dumps for Microsoft Dynamics CRM MB2-703 Practice Exam Questions Free

How to import CSV files into DataTable in C#

How to show enlarge image when mouse hover on image or link in Asp.Net(c#) using JavaScript

go to top image