Add option set item based on the specific Apps in Dynamic crm

 // Filter field value based on  App 

onLoadFilter function(executionContext) {

    "use strict";

    try{

    var formContext = executionContext.getFormContext();

    var globalContext = Xrm.Utility.getGlobalContext();

    globalContext.getCurrentAppProperties().then(function (object) {

        if (object.uniqueName === "App Schema Name") {

            var formContext = executionContext.getFormContext();

            var optionSetCtrl = formContext.getControl("field schema name");

            optionSetCtrl.clearOptions();


            optionSetCtrl.addOption({ value: 999999993, text: "A" }, 1);

            optionSetCtrl.addOption({ value:  999999994, text: "B" }, 2);

            optionSetCtrl.addOption({ value:  999999995, text: "Cr" }, 3);

            optionSetCtrl.addOption({ value:  999999996, text: "D" }, 4);

            optionSetCtrl.addOption({ value:  999999997, text: "E" }, 5);

            optionSetCtrl.addOption({ value:  999999996, text: "F" }, 6);

     }

    });

    }

    catch (error) {

        Error_ExternalForm("Close", error.message, "Error");

    }

}


Error_ExternalForm = function (buttonLabel, textMessage, titleText) {

    "use strict";

    //  Use new v9 API to handle the error

    //  Alert the User

    var alertStrings = { confirmButtonLabel: buttonLabel, text: textMessage, title: titleText };

    var alertOptions = { height: 120, width: 260 };

    Xrm.Navigation.openAlertDialog(alertStrings, alertOptions);

}



Comments

Popular posts from this blog

latest dynamics 365 interview questions for more than 2 years of experience

difference between enable rule vs display rule in ribbon workbench

If i create one record that created record date is older than 3 days, then I want to perform some operation with the help of business rule.