My Photo

Microsoft Dynamics 365

Official Blog for Microsoft Dynamics Functional and Technical Solutions....
Browsing Category " JSCRIPT "

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 {

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();

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.IN
Subscribe to our YouTube channel : https://www.youtube.com/user/TheRussell2012

DATE VALIDATION ( GET DATE , MONTH AND YEAR FROM AN FIELD) USING JAVASCRIPT IN MSCRM 2011 , 2013

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