How to use the setIsValid Method in Dataverse / Dynamics 365


We can use the setIsValid method for validating field values in Model-driven apps. This method helps ensure that the data entered by users meets the required criteria before it’s processed or saved.

The setIsValid method is used to set the validity of a column’s value. It can mark a field as valid or invalid based on custom validation logic.

formContext.getAttribute(arg).setIsValid(bool, message);

bool: A Boolean value. Set to false to mark the column value as invalid, and true to mark it as valid.

message: (Optional) A string containing the message to display when the value is invalid.

Below we are using the setIsValid method in the function that ensures that the “End Date” is earlier than or equal to the “Start Date”, else it will mark the “End Date” as invalid.

function validateDates(executionContext) {
    var formContext = executionContext.getFormContext();
    var startDate = formContext.getAttribute("custom_startdate");
    var endDate = formContext.getAttribute("custom_enddate");
  
    if (startDate && endDate && endDate.getValue() <= startDate.getValue()) {
        endDate.setIsValid(false, "End Date must be after Start Date.");
    } else {
        endDate.setIsValid(true);
    }
}

We have it registered in the On Change of the ‘Start Date’ and ‘End Date’ fields.

Here if we try saving the record, if the End Date is smaller than the Start Date, we will get the message specified.

Hope it helps..

Advertisements

Use OptionSet Wrapper component to show color-coded options on the form – Model-driven apps/ Dynamics 365


We can make use of the OptionSet Wrapper component to show color-coded options on the form for the choices or option set fields.

Below we have added the Option Set wrapper component to the Rating field of the lead in the Lead (Main) form.

We can see the field added but do not see any colors for it.

A screenshot of a contact form

Description automatically generated

This is because it uses the color defined for that column, which wasn’t defined out of the box for that field.

We then defined the colors as shown below for different choices / options.

After saving and publishing our changes, we were able to see the corresponding color for the choices.

A screenshot of a computer

Description automatically generated

Also check –

Hope it helps..

Advertisements

Select record quickly inside Lookup control – Model-driven app /Dynamics 365


There is a small enhancement added to the Lookup Control as part of Release Wave 2.

After performing a search for a specific record inside the Lookup Control dropdown menu, e.g. we have performed a search on “co*” on the Customer Lookup for Case.

We can press Enter to have the first item in the list selected.

Get more details

Hope it helps..

Advertisements

Resizing of side panes now possible – 2024 Release Wave 2 (Model-driven apps / Dynamics 365)


With 2024 Release Wave 2, now we can resize the side panes inside the Model-driven app.

Side panes are used for Teams chat, Copilot Chat, loading Web Resource, etc.

With Release Wave 2 enabled, we get the option to drag and adjust the size.

A screenshot of a computer

Description automatically generated

Below we have dragged it to maximum size.

A screenshot of a computer

Description automatically generated

Get all details

Hope it helps.. 

Advertisements

New features added in Grid– Dataverse / Dynamics 365


With Release Wave 2, we can see the below features added to Grid.

The option to Group By, Column Width, Move Left and Move Right.

A screenshot of a computer

Description automatically generated

Group By (Rating) –

A screenshot of a computer

Description automatically generated

Move Left and Move Right as expected will move the selected column accordingly. Not only that we can also Drag and Drop the columns, here we have dragged the Rating column as the 1st column.

A screenshot of a computer

Description automatically generated

Column Width – allows us to specify the preferred width of the column.

A screenshot of a computer

Description automatically generated

Totals > None, Average, Maximum, Minimum, Sum.

For the numerical column, Annual Revenue in this case we get the option to calculate the total

A screenshot of a computer

Description automatically generated

Selecting Total > Sum, adds a row at the bottom, showing the total sum

A screenshot of a computer

Description automatically generated

Similarly selecting minimum shows the minimum value.

A screenshot of a computer

Description automatically generated

Hope it helps..

Advertisements

Hide / Show Legacy App (Dynamics 365 – Custom) from Everyone and / or Admin – Model-Driven App / Dynamics 365


From the Power Platform Admin Center for a particular Environment, through Settings >> Product >> Behaviour >> Show legacy app for admins option, we can control visibility of the Legacy App (Dynamics 365 – Custom) for admins.

If Show legacy app for admins = On –

A screenshot of a computer

Description automatically generated

An admin can see the app

A screenshot of a computer

Description automatically generated

By setting it to Off

A screenshot of a computer

Description automatically generated

We can see the app hidden for the admins also.

A screenshot of a computer

Description automatically generated

The aim is that all the users including admin must use only the modern, model-driven apps.

Get more details

Hope it helps..

Advertisements