Posts

HOW TO GET MICROSOFT DYNAMICS 365 FORM TYPE IN JAVASCRIPT

Image
When working with forms, you have the ability to create different types of forms based on your needs : Main Form, Quick View Form, Quick Create Form, or Card Form. The most common type is the Main Form which is the form where most of time the users work. The main form itself has different status that represents specific functionality or use, this is known as well as form type . The purpose of this post is to know what are the different types of the Main form and how to get it using JavaScript , so you will have the ability to change its behavior based on its type that will be reflected for end users. Getting the type of form can be done in JavaScript using the function formContext.ui.getFormType() . The following JavaScript function will display a popup message with the form type: function getFormType(context) { var formContext =

DISABLE ALL FORM FIELDS IN DYNAMICS 365 USING JAVASCRIPT

Image
To make the form read-only in Dynamics 365 you have 3 options: changing record status to Inactive, Business rule, JavaScript. The purpose of this article is to know how to make all form fields disabled with JavaScript. Changing record status to Inactive might not very suitable for some cases where cascading rules might be applied to children records. On the other hand, even though it is a low code solution, using business rule to make all fields read-only will be very time consuming especially if a field is removed from the form or a new field is added to the form. However, using JavaScript will allow you to set all form fields to read-only dynamically with a small piece of code and you can do it based on a certain condition of an attribute value. Make read-only the whole fields of a form based on a certain condition

CHANGE ROLLUP FIELD RECURRENCE SCHEDULE IN DATAVERSE / DYNAMICS 365

Image
One of the features in Dynamics 365 is the rollup field type where you can perform aggregation and calculation of data in a parent record based on child records. You create a rollup field by adding a new field, choosing the field and data type, and building the logic for the calculation. One of the important consideration of a rollup field is the frequency of its calculation where, for each entity that contains a rollup field, a recurring system job will be automatically created in order to calculate the rollup field. This calculation is done asynchronously based on a frequency set. By default, it is set to 1 hour, however, you can change this frequency by following the below steps. In the environment, go to Settings page and under Audit and logs menu, click on System jobs C

OPEN DYNAMICS 365 ADVANCED FIND BY DEFAULT IN DETAILED MODE

Image
To the ones who use Advanced Find, today's article is related to how you can optimize its usage. By default, and when you open the Advanced Find page, it will display the current view you are seeing, with the conditions predefined. For example Active accounts or Active contacts will display the condition Status | Equals | Active . In addition, you will notice that you will not be able to apply more filters in the Advanced Find, unless you click the Details button. In this article, we will see how to open the Advanced Find in detailed mode and directly change the filters without clicking additional button Advanced Find is by default opened in Simple mode Once you click Details button, you can change the existing filters and add new ones if needed

SEARCH BY GUID IN DYNAMICS 365

Image
Is it possible to search for a CRM record using its GUID ? Well, NO it is not possible and YES it is possible!!! As always has been, it is not possible to search for a record by its guid in Advanced Find and in the Quick view search. However, in the model-driven app Edit filters functionality, it is possible to search for a record by its Guid. How it works, let's check the 3 different places where we can search for a records. Advanced Find search Using the Advanced find feature, you cannot put a GUID value to search for. You will directly receive an error notification eventhough when you download the fetchXml, the Guid of the record will be there. Quick view search Using the search box

SAVE FORM IN DYNAMICS 365 JAVASCRIPT

Image
In Dynamics 365, you may need to save a CRM form automatically in JavaScript upon a specific action on the form. In order to do that, the function formContext.data.save(saveOptions).then(successCallback, errorCallback); can be used to save the record asynchronously with callback functions to be executed after the save operation is completed. The following example will display a successful message if the save operation is completed, and a failure message if not. formContext.data.save(1).then( function () { alert("Successfully Saved!"); }, function () { alert("Failed while saving!"); });

CHANGE CONTROL LABEL DURING RUNTIME IN DYNAMICS 365 USING JAVASCRIPT

Image
In Dynamics 365, we might have to change CRM control label at runtime for specific needs. This can be easily done through JavaScript code by calling the function setLabel() that sets the label of the control. One function, several ways you can use to change the label based on the control type. Dynamically change a tab label Using the function setLabel , you can change a tab label during runtime as per the below code snippet. var runtimeTabLabel = "Runtime Tab Label"; formContext.ui.tabs.get("<tabName>").setLabel(runtimeTabLabel); Dynamically change section label Using the function setLabel , you can change a section label during r

CHECKING DIRTY FIELDS IN DYNAMICS 365 USING JAVASCRIPT

Image
In Dynamics 365, there is a common need to identify which fields have been modified on the form during an update. One way is by creating a Plugin that will receive data of the modified fields in the current update event. However, the purpose of this article is to check how to identify the modified fields through JavaScript . It is done by verifying if the form or fields are in a dirty state which indicates if they have been changed. Three methods are available that you can use to get if the form or specific fields are dirty. Check if form is dirty to verify if any field on the form has been changed. Using the function getIsDirty , you can check if any field on the form has been modified. formContext.data.entity.getIsDirty();

SET DYNAMICS 365 MULTISELECT OPTIONSET FIELD IN C#

As known, Multi-Select Option set field helps you select more than one option. Sometimes, you want to dynamically select one or more option in the multiselect field. In another post, we saw how to set a value of a multiselect option set field in JavaScript In this post, we will see how to set options of a multiselect option set field in C# The below code snippet can be used to add the needed options you want to set for the multi select option set field OptionSetValueCollection osvc = new OptionSetValueCollection(); osvc.Add(new OptionSetValue(<integerValueOptionSet>)); Once the needed options are added to the OptionSetValueCollection , you can add it to the list of attributes of

SETSUBMITMODE IN DYNAMICS 365 JAVASCRIPT

Image
In Dynamics 365, there are some scenarios where you want to always submit or never submit the value of a column into the database. To do this, you have to use the JavaScript method setSubmitMode that will control whether the data for a column is submitted when a record is created or saved. In case you have a column that you are not interest to capture its data, use the never parameter for the setSubmitMode method. While, if you want to force a column value to be submitted whether it has changed or not, use the always parameter for the setSubmitMode method. Use one of the below three options for the setSubmitMode function as per the below. always : The data is always sent with a create/save event and can be captured within the entity attributes in a plugin function setSubmitModeField(context) { var formCont

ACCESS FIELDS OF QUICK VIEW FORM THROUGH JAVASCRIPT IN DYNAMICS 365

Image
As known, quick view controls are associated to lookup fields that are included in a form and they are added to display specific information about the selected record in the lookup field. This will increase user experience where the users do not need to navigate to a different record to see the information needed. However, you might have requirements where you want to check a field value of the quick view form control in order to apply specific behavior on the main form. In this post, we will see how to access Quick View Form fields through JavaScript in Dynamics 365 . For the sake of this post, we will work with a contact quick view form control on the account form. Based on the primary contact Relationship Type field, a specific section on the account form will be displayed. Relationship Type field of the contact = Employee => Employee

FILTER LOOKUP IN DYNAMICS 365 BASED ON CONDITION IN JAVASCRIPT WITH ADDCUSTOMFILTER AND ADDPRESEARCH

Image
Working with lookups provide you many possibilities regarding filtering the records displayed in the lookup. You can do it by using the out of the box related records filtering in the lookup field properties, however and in some scenarios, this approach does not provide what you need. Therefore, writing JavaScript code is mandatory to achieve what you want, which is the topic of this post In other post, we saw how to filter lookup field in JavaScript using the function addCustomView In this post, we will see how to filter a lookup field in JavaScript using addPreSearch and addCustomFilter functions . For the sake of this post, we will filter the Parent Account lookup in the account form based on the category field

DISABLE SECURITY DEFAULTS FOR DYNAMICS 365 ENVIRONMENT

Image
When creating a Dynamics 365 Trial environment, each time you want to login, you will be promted by a security message. Security Defaults are a series of settings enabled by default on your Microsoft Office 365 account, to provide better security where every user is required to log in using Multi-Factor Authentication (MFA). To know more information about the Security Defaults, check Microsoft's documentation . In this post, we will see how to disable Security Defaults message when logging in . You can change the security defaults from Office 365 Admin center or from the Azure Portal Log into your Office 365 management area > Admin > Azure Active Directory or from the Azure portal > Azure Active Directory Under Azure Active Directory , click Properties and then Manage Security

GET THE SIZE OF DYNAMICS 365 TABLES FOR ON PREMISES ORGANIZATION

Image
In previous post, we saw how to get the size of Dynamics 365 / Dataverse tables for an online environment In this post, we will see how to get the size of Dynamics 365 tables for an on premises organization . In order to check the tables size, you need to open the SQL server Management Studio and execute the below query In the Management Studio, click New Query or expand the Databases list and right click the needed database > New Query In the query editor, execute the below query by putting the correct database name USE <DatabaseName> GO SELECT t.Name AS TableName, s.Name

GET THE SIZE OF TABLES IN DYNAMICS 365 / DATAVERSE ENVIRONMENT

Image
Data size is continuously growing over the time. Thus, data storage and usage with the increasing complexity and new supported data types, is becoming an essential tool for the organizations to be able to expand their business. Therefore, knowing the data volume becomes very critical and in Dataverse, you are able to check the space reserved by each table. In this post, we will see how to get the size of Dynamics 365 / Dataverse tables for an environment . Using the Capacity page in the Power Platform Admin Center, you can get the size of each table (in MB). Login to Power Platform admin Center Under the Resources menu, click the Capacity option Select the Dataverse tab, or click on the Trial tab to check the environments