JSCRIPT Archives - Microsoft Dynamics 365 Blog https://microsoftdynamics.in/category/jscript/ Microsoft Dynamics CRM . Microsoft Power Platform Mon, 18 Dec 2017 10:33:00 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.5 https://i0.wp.com/microsoftdynamics.in/wp-content/uploads/2020/04/cropped-Microsoftdynamics365-blogs.png?fit=32%2C32&ssl=1 JSCRIPT Archives - Microsoft Dynamics 365 Blog https://microsoftdynamics.in/category/jscript/ 32 32 176351444 How to make a MS CRM form read only by Javascript https://microsoftdynamics.in/2017/12/18/how-to-make-a-ms-crm-form-read-only-by-javascript/ Mon, 18 Dec 2017 10:33:00 +0000 http://microsoftdynamics.in/2017/12/18/how-to-make-a-ms-crm-form-read-only-by-javascript/ Use this code on the page load event of MS CRM  2011/2013 function ReadOnly (){    var controls = Xrm.Page.ui.controls.get();    for (var i in controls)    {        var control = controls[i];        if (!control.getDisabled())        {            control.setDisabled(true);        }   ...

The post How to make a MS CRM form read only by Javascript appeared first on Microsoft Dynamics 365 Blog.

]]>
Use this code on the page load event of MS CRM  2011/2013


function ReadOnly ()
{
    var controls = Xrm.Page.ui.controls.get();
    for (var i in controls)
    {

        var control = controls[i];
        if (!control.getDisabled())
        {
            control.setDisabled(true);
        }
    }
}

SOURCE : mscrm.com

The post How to make a MS CRM form read only by Javascript appeared first on Microsoft Dynamics 365 Blog.

]]>
2769
How to Create Dynamic OptionSet in MS Dynamics CRM 2011 & 2013 dynamics365 https://microsoftdynamics.in/2017/12/18/how-to-create-dynamic-optionset-in-ms-dynamics-crm-2011-2013-dynamics365/ Mon, 18 Dec 2017 10:29:00 +0000 http://microsoftdynamics.in/2017/12/18/how-to-create-dynamic-optionset-in-ms-dynamics-crm-2011-2013-dynamics365/ How to Create Dynamic OptionSet in MS Dynamics CRM 2011 & 2013 This code will help you……………… function dynamicoptionset() { //get value in no in variable     var totaldivision = Xrm.Page.getAttribute(“fieldname” ).getValue();     if (totaldivision == null || totaldivision == “” )         return;     else {         var optionsetControl = Xrm.Page.ui.controls.get( “new_division” );         var options = optionsetControl.getAttribute().getOptions();         optionsetControl.clearOptions();         for ( var i = 0; i < totaldivision; i++) {             optionsetControl.addOption(options[i]);         }    ...

The post How to Create Dynamic OptionSet in MS Dynamics CRM 2011 & 2013 dynamics365 appeared first on Microsoft Dynamics 365 Blog.

]]>
How to Create Dynamic OptionSet in MS Dynamics CRM 2011 & 2013

This code will help you………………
function dynamicoptionset() {

//get value in no in variable
    var totaldivision = Xrm.Page.getAttribute(“fieldname” ).getValue();
    if (totaldivision == null || totaldivision == “” )
        return;
    else {
        var optionsetControl = Xrm.Page.ui.controls.get( “new_division” );
        var options = optionsetControl.getAttribute().getOptions();

        optionsetControl.clearOptions();
        for ( var i = 0; i < totaldivision; i++) {

            optionsetControl.addOption(options[i]);
        }
    }
}


SOURCE : mscrm.com

The post How to Create Dynamic OptionSet in MS Dynamics CRM 2011 & 2013 dynamics365 appeared first on Microsoft Dynamics 365 Blog.

]]>
2771
SET AND GET VALUE FROM LOOKUP TO LOOKUP USING JAVASCRIPT IN MSCRM 2011 , 2013 https://microsoftdynamics.in/2014/02/24/set-and-get-value-from-lookup-to-lookup-using-javascript-in-mscrm-2011-2013/ https://microsoftdynamics.in/2014/02/24/set-and-get-value-from-lookup-to-lookup-using-javascript-in-mscrm-2011-2013/#comments Mon, 24 Feb 2014 04:36:00 +0000 http://microsoftdynamics.in/2014/02/24/set-and-get-value-from-lookup-to-lookup-using-javascript-in-mscrm-2011-2013/ function lookuptolookup() {     //want the code to run only when some one update form click here to know about FORM TYPE     var formtype = Xrm.Page.ui.getFormType();     if (formtype == 2) {         //look have the values ” 1.id 2. name 3. entity type ” so need to be in array         var lookup = new Array();         lookup = Xrm.Page.getAttribute( “new_test5_lookup” ).getValue();         if (lookup != null) {             var name...

The post SET AND GET VALUE FROM LOOKUP TO LOOKUP USING JAVASCRIPT IN MSCRM 2011 , 2013 appeared first on Microsoft Dynamics 365 Blog.

]]>

function lookuptolookup() {
    //want the code to run only when some one update form click here to know about FORM TYPE
    var formtype = Xrm.Page.ui.getFormType();
    if (formtype == 2) {
        //look have the values ” 1.id 2. name 3. entity type ” so need to be in array
        var lookup = new Array();
        lookup = Xrm.Page.getAttribute( “new_test5_lookup” ).getValue();
        if (lookup != null) {
            var name = lookup[0].name;
            var id = lookup[0].id;
            var entityType = lookup[0].entityType;
        }
        var lookup1 = new Array();
        lookup1[0] = new Object();
        lookup1[0].id = id;
        lookup1[0].name = name;
        lookup1[0].entityType = entityType;
        //set value of lookup2 same as look up 1
        Xrm.Page.getAttribute( “new_test_5_lookup_2” ).setValue(lookup1);
    }
}




SOURCE : JUST2CODE.IN
Subscribe to our YouTube channel : https://www.youtube.com/user/TheRussell2012

The post SET AND GET VALUE FROM LOOKUP TO LOOKUP USING JAVASCRIPT IN MSCRM 2011 , 2013 appeared first on Microsoft Dynamics 365 Blog.

]]>
https://microsoftdynamics.in/2014/02/24/set-and-get-value-from-lookup-to-lookup-using-javascript-in-mscrm-2011-2013/feed/ 1 2834
DYNAMICALLY HIDE MULTIPLE FIELDS / ATTRIBUTE IN A FORM USING JAVASCRIPT IN MSCRM 2011 , 2013 https://microsoftdynamics.in/2014/02/18/dynamically-hide-multiple-fields-attribute-in-a-form-using-javascript-in-mscrm-2011-2013/ Tue, 18 Feb 2014 07:39:00 +0000 http://microsoftdynamics.in/2014/02/18/dynamically-hide-multiple-fields-attribute-in-a-form-using-javascript-in-mscrm-2011-2013/ function fields() {     var i;     for (i = 1 ; i <= 20; i++) {         //convert i into string         var j = i.toString();         var obj = “new_field” + j;         alert(obj);         Xrm.Page.ui.controls.get(obj).setVisible( false);     } } SOURCE : JUST2CODE.IN Subscribe to our YouTube channel : https://www.youtube.com/user/TheRussell2012

The post DYNAMICALLY HIDE MULTIPLE FIELDS / ATTRIBUTE IN A FORM USING JAVASCRIPT IN MSCRM 2011 , 2013 appeared first on Microsoft Dynamics 365 Blog.

]]>
function fields() {
    var i;
    for (i = 1 ; i <= 20; i++) {
        //convert i into string
        var j = i.toString();
        var obj = “new_field” + j;
        alert(obj);

        Xrm.Page.ui.controls.get(obj).setVisible( false);
    }
}


SOURCE : JUST2CODE.IN
Subscribe to our YouTube channel : https://www.youtube.com/user/TheRussell2012

The post DYNAMICALLY HIDE MULTIPLE FIELDS / ATTRIBUTE IN A FORM USING JAVASCRIPT IN MSCRM 2011 , 2013 appeared first on Microsoft Dynamics 365 Blog.

]]>
2839
How to Enable JavaScript Intellisense in any version of Visual Studio https://microsoftdynamics.in/2014/02/15/how-to-enable-javascript-intellisense-in-any-version-of-visual-studio/ https://microsoftdynamics.in/2014/02/15/how-to-enable-javascript-intellisense-in-any-version-of-visual-studio/#comments Sat, 15 Feb 2014 06:28:00 +0000 http://microsoftdynamics.in/2014/02/15/how-to-enable-javascript-intellisense-in-any-version-of-visual-studio/ Download The Required JS Files from here . Paste “XrmPage-vsdoc.js” file to your C Drive. Open Visual Studio and press Ctrl + N and select Script tab and then open javascript file.   Paste this part of code on the top of your file without quotes “///<reference path=”c:/XrmPage-vsdoc.js” />”. Now start writing your JScript code....

The post How to Enable JavaScript Intellisense in any version of Visual Studio appeared first on Microsoft Dynamics 365 Blog.

]]>
  1. Download The Required JS Files from here .
  2. Paste “XrmPage-vsdoc.js” file to your C Drive.
  3. Open Visual Studio and press Ctrl + N and select Script tab and then open javascript file.

     

  4. Paste this part of code on the top of your file without quotes “///<reference path=”c:/XrmPage-vsdoc.js” />”.
  5. Now start writing your JScript code.
  6. Now you have Intellisense Enabled JScript Visual Studio for MS CRM 2011 & 2013.


SOURCE : MSCRM.com

The post How to Enable JavaScript Intellisense in any version of Visual Studio appeared first on Microsoft Dynamics 365 Blog.

]]>
https://microsoftdynamics.in/2014/02/15/how-to-enable-javascript-intellisense-in-any-version-of-visual-studio/feed/ 1 2844
HIDE TABS IN AN ENTITY USING JAVASCRIPT IN MSCRM 2011 , 2013 https://microsoftdynamics.in/2014/02/14/hide-tabs-in-an-entity-using-javascript-in-mscrm-2011-2013/ Fri, 14 Feb 2014 08:04:00 +0000 http://microsoftdynamics.in/2014/02/14/hide-tabs-in-an-entity-using-javascript-in-mscrm-2011-2013/ function BalanceAccountTypeChange() {     var GenralAccount = 100010002;     var Bank = 100010003;     var balance_account = Xrm.Page.data.entity.attributes.get(“new_balanceaccounttype” ).getValue();     switch (balance_account) {         case GenralAccount:             Xrm.Page.ui.tabs.get(“GeneralJournalBatchesDetails” ).sections.get( “BalanceAccountTypeBank”).setVisible( false);             Xrm.Page.ui.tabs.get(“GeneralJournalBatchesDetails” ).sections.get( “BalanceAccountTypeGeneralAccount”).setVisible( true);             break;         case Bank:             Xrm.Page.ui.tabs.get(“GeneralJournalBatchesDetails” ).sections.get( “BalanceAccountTypeBank”).setVisible( true);             Xrm.Page.ui.tabs.get(“GeneralJournalBatchesDetails” ).sections.get( “BalanceAccountTypeGeneralAccount”).setVisible( false);             break;         default:             Xrm.Page.ui.tabs.get(“GeneralJournalBatchesDetails” ).sections.get( “BalanceAccountTypeBank”).setVisible( false);             Xrm.Page.ui.tabs.get(“GeneralJournalBatchesDetails” ).sections.get( “BalanceAccountTypeGeneralAccount”).setVisible( false);             break;     } } // null values for feilds on balance account type change function BalanceAccountTypeNullonchange() {     Xrm.Page.getAttribute( “new_generalaccount” ).setValue(null );     Xrm.Page.getAttribute( “new_bankaccount” ).setValue(null ); } SOURCE : JUST2CODE.INSubscribe to...

The post HIDE TABS IN AN ENTITY USING JAVASCRIPT IN MSCRM 2011 , 2013 appeared first on Microsoft Dynamics 365 Blog.

]]>

function
 BalanceAccountTypeChange() {
    var GenralAccount = 100010002;
    var Bank = 100010003;

    var balance_account = Xrm.Page.data.entity.attributes.get(“new_balanceaccounttype” ).getValue();
    switch (balance_account) {
        case GenralAccount:
            Xrm.Page.ui.tabs.get(“GeneralJournalBatchesDetails” ).sections.get( “BalanceAccountTypeBank”).setVisible( false);
            Xrm.Page.ui.tabs.get(“GeneralJournalBatchesDetails” ).sections.get( “BalanceAccountTypeGeneralAccount”).setVisible( true);
            break;
        case Bank:
            Xrm.Page.ui.tabs.get(“GeneralJournalBatchesDetails” ).sections.get( “BalanceAccountTypeBank”).setVisible( true);
            Xrm.Page.ui.tabs.get(“GeneralJournalBatchesDetails” ).sections.get( “BalanceAccountTypeGeneralAccount”).setVisible( false);
            break;
        default:
            Xrm.Page.ui.tabs.get(“GeneralJournalBatchesDetails” ).sections.get( “BalanceAccountTypeBank”).setVisible( false);
            Xrm.Page.ui.tabs.get(“GeneralJournalBatchesDetails” ).sections.get( “BalanceAccountTypeGeneralAccount”).setVisible( false);
            break;
    }
}
// null values for feilds on balance account type change
function BalanceAccountTypeNullonchange() {
    Xrm.Page.getAttribute( “new_generalaccount” ).setValue(null );
    Xrm.Page.getAttribute( “new_bankaccount” ).setValue(null );
}

SOURCE : JUST2CODE.IN
Subscribe to our YouTube channel : https://www.youtube.com/user/TheRussell2012

The post HIDE TABS IN AN ENTITY USING JAVASCRIPT IN MSCRM 2011 , 2013 appeared first on Microsoft Dynamics 365 Blog.

]]>
2851
DATE VALIDATION ( GET DATE , MONTH AND YEAR FROM AN FIELD) USING JAVASCRIPT IN MSCRM 2011 , 2013 https://microsoftdynamics.in/2014/02/14/date-validation-get-date-month-and-year-from-an-field-using-javascript-in-mscrm-2011-2013/ Fri, 14 Feb 2014 08:01:00 +0000 http://microsoftdynamics.in/2014/02/14/date-validation-get-date-month-and-year-from-an-field-using-javascript-in-mscrm-2011-2013/ function onjoiningdate(){//get the value of date of joiningvar startday=Xrm.Page.getAttribute(“new_joiningdate”).getValue();var today=new Date();var one_day=1000*60*60*24;var one_month=30;var onevar starttime=startday.getTime();var currenttime=today.getTime();//alert(starttime);//alert(currenttime);var difference = Math.abs(currenttime – starttime);//alert(difference);noofdays=Math.round(difference/one_day)noofmonths=Math.round(noofdays/one_month);//alert(noofdays);//alert(noofmonths);Xrm.Page.getAttribute(“new_loyaltyduration”).setValue(noofmonths);} SOURCE : JUST2CODE.INSubscribe to our YouTube channel : https://www.youtube.com/user/TheRussell2012

The post DATE VALIDATION ( GET DATE , MONTH AND YEAR FROM AN FIELD) USING JAVASCRIPT IN MSCRM 2011 , 2013 appeared first on Microsoft Dynamics 365 Blog.

]]>
function onjoiningdate()
{
//get the value of date of joining
var startday=Xrm.Page.getAttribute(“new_joiningdate”).getValue();

var today=new Date();
var one_day=1000*60*60*24;
var one_month=30;
var one
var starttime=startday.getTime();
var currenttime=today.getTime();
//alert(starttime);
//alert(currenttime);
var difference = Math.abs(currenttime – starttime);
//alert(difference);
noofdays=Math.round(difference/one_day)
noofmonths=Math.round(noofdays/one_month);
//alert(noofdays);
//alert(noofmonths);
Xrm.Page.getAttribute(“new_loyaltyduration”).setValue(noofmonths);
}

SOURCE : JUST2CODE.IN
Subscribe to our YouTube channel : https://www.youtube.com/user/TheRussell2012

The post DATE VALIDATION ( GET DATE , MONTH AND YEAR FROM AN FIELD) USING JAVASCRIPT IN MSCRM 2011 , 2013 appeared first on Microsoft Dynamics 365 Blog.

]]>
2853