Posts

Showing posts from December, 2023

How to filter regarding entity in dynamic CRM using JavaScript

Image
 //filter regarding function regardingFilter (executionContext)  { var formContext = executionContext.getFormContext(); var regarding = formContext.getControl("regardingobjectid") ? formContext.getControl("regardingobjectid") : null; if (regarding.getEntityTypes().length >= 1)             {                regarding.setEntityTypes(['opportunity']);           }                        } Screenshot:  After filter: Before filter :

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

How to redirect tab directly in dynamic CRM using JavaScript

Image
Step 1: Go to form properties. Step 2: click on parameter tab. Step 3: Add one parameter like below  var formType = formContext.ui.getFormType();     if (formType === 2) {         if (formContext.data.attributes.get("param_focusCaseTab") !== undefined && formContext.data.attributes.get("param_focusCaseTab").getValue() !== null) {             var param_focusCaseTab = formContext.data.attributes.get("param_focusCaseTab").getValue();             if (param_focusCaseTab === true) {                 formContext.ui.tabs.get("tab_cases").setFocus();             }         }     }