Tag: Dynamics CRM

I Wish I Would Have Known #31: App Access Checker

App access checker image

You can enter a user’s email address and see the list of published apps in your environment and all the access, license, and security information specific to that user. This can be very useful in troubleshooting why a user cannot see a specific app in your environment. The tool can be accessed from the admin center or via direct URL.

https://<org>.crm.dynamics.com/WebResources/msdyn_AppAccessChecker.html 

Hope this helps..

Early Bound vs Late Bound Programming in Dataverse

image of a computer screen with programming code

As you all know, when working with code for Microsoft Dataverse we have two options late-bound and early-bound. I have seen many people advocating one option over another and explaining why one is better than the other. For me, it’s just a personal choice, if you prefer typed classes go for early bound else go for the late-bound approach. Add some additional details below to help you to select a programming option.

Early Bound

Early-bound programming requires that you first generate a set of classes based on the table and column definitions (entity and attribute schema) for a specific environment using the code generation tool. Once generated you can enjoy better IntelliSense and compile-time checking of all types so that no implicit casts occur. Below is the sample early bind code from Microsoft Docs which creates an account record.

var account = new Account();
// set attribute values
    // string primary name
    account.Name = "Contoso";
    // Boolean (Two option)
    account.CreditOnHold = false;
    // DateTime
    account.LastOnHoldTime = new DateTime(2017, 1, 1);
    // Double
    account.Address1_Latitude = 47.642311;
    account.Address1_Longitude = -122.136841;
    // Int
    account.NumberOfEmployees = 500;
    // Money
    account.Revenue = new Money(new decimal(5000000.00));
    // Picklist (Option set)
    account.AccountCategoryCode = new OptionSetValue(1); //Preferred customer

//Create the account
Guid accountid = svc.Create(account);

Late Bound

Here you don’t need to generate the classes, you directly start wrting your logic, However, you need to refer to tables and columns (entities and attributes) using their LogicalNames in the Entity class. You don’t get compile-time validation on names of entities, attributes, and relationships. Types are checked only when the object is created. Below is the sample late bind code from Microsoft Docs which creates an account record.

//Use Entity class specifying the entity logical name
var account = new Entity("account");

// set attribute values
    // string primary name
    account["name"] = "Contoso";            
    // Boolean (Two option)
    account["creditonhold"] = false;
    // DateTime
    account["lastonholdtime"] = new DateTime(2017, 1, 1);
    // Double
    account["address1_latitude"] = 47.642311;
    account["address1_longitude"] = -122.136841;
    // Int
    account["numberofemployees"] = 500;
    // Money
    account["revenue"] = new Money(new decimal(5000000.00));
    // Picklist (Option set)
    account["accountcategorycode"] = new OptionSetValue(1); //Preferred customer
                
//Create the account
Guid accountid = svc.Create(account);

Now let’s do a comparison on both.

Early-boundLate-bound
You can verify entity, attribute, and relationship names at compile timeNo compile-time verification of entity, attribute, and relationship names
You must generate entity classesYou don’t need to generate entity classes
Better IntelliSense supportLess IntelliSense support
Less readable codeMore readable code
Slightly less performantSlightly more performant
Generated classes are quite largeGenerated classes are small

Hope this helps.

Event Execution Pipeline in Dataverse/Dynamics 365

When the standard low-code options cannot handle your business logic in an expected manner, as a developer, you can use custom event handlers in Microsoft Dataverse. The Event Framework provides the capability to register custom code to be run in response to specific events.

The custom code options available are Plugins, Azure integrations, virtual table data providers, and Webhooks, etc… When configured correctly using the plugin registration tool, these custom code extensions will respond to events that are provided by the event framework.

When an event occurs a message is sent to the organization Web service to process the event. The message contains information about the event, such as details of the table where the event occurred, dataverse organization details, details of the user who triggered the event, etc… There is a specific message for each event such as create, update, retrieve, retrieve multiple, associate, disassociate, delete, etc… Each message is processed in a series of 4 stages called the event execution pipeline and your custom code extension can be registered at any of these stages based on your business need. See the below table for the details about each stage.

Stage NameDescription
PreValidationThis stage will occur before the main system operation. This provides an opportunity to include logic to cancel the operation before the database transaction.
This stage occurs before any security checks are performed to verify that the calling or logged-on user has the correct permission to perform the intended operation.
PreOperationOccurs before the main system operation and within the database transaction. If you want to change any values for an entity included in the message, you should do it here.

Avoid canceling an operation here. Canceling will trigger a rollback of the transaction and have a significant performance impact.
MainOperationFor internal use only except for Custom API and Custom virtual table data providers.
More information:
Create and use Custom APIs
Custom Virtual table data providers
PostOperationOccurs after the main system operation and within the database transaction. Use this stage to modify any properties of the message before it is returned to the caller.

Avoid applying changes to an entity included in the message because this will trigger a new Update event.

Within the PostOperation stage, you can register steps to use the asynchronous execution mode. These steps will run outside of the database transaction using the asynchronous service. More information Asynchronous service.

Hope this helps.

I Wish I Would Have Known #29: Default Environment Limitations

I Wish I Would Have Known strip 29: Default Environment Limitations

A single default environment is automatically created by Power Apps for each tenant and shared by all users in that tenant. Whenever a new user signs up for Power Apps, they’re automatically added to the Maker role of the default environment. The default environment is created in the region closest to the default region of the Azure AD tenant. Read more

Why You Should Care About Web Accessibility

Accessibility is a common term now and you might have heard many definitions of accessibility. For me, accessibility is simply creating a better experience for everyone.

We all know what accessibility means in the physical world, because we see it, right? Handrails for stairs, wheelchair access to the building, dedicated wheelchair parking lots, signboard in a building. Let’s take the signboard as an example, is it helpful only for disabled people? Assume you are visiting a hospital for the first time, and you need to use the washroom. You will search for the washroom signboard, right? Or Take the handrails, it is helpful for fully-abled people as well. This is why I used the word everyone in the introduction paragraph. If we design something with accessibility in mind, it is going to be helpful for everyone including fully-abled people.

Wheelchair Parking Slot
Image: Wheelchair parking slot

What you may or may not realize is that these accommodations also exist in today’s digital technology. In fact, many of them have been there for a while, but perhaps they’re less well known, hidden, or perhaps you’re using them without even knowing it. Some of the common accessibility tools used in the web world are Screen Readers, Screen magnifiers, Color Contrast Combinations, Keyboard and Mouse, Speech to text, Word Prediction, etc…

Have you ever considered if the application you have developed is compatible with the accessibility tools mentioned earlier? If you think you or your users never use such aids, then you need to realize that disability is highly related to the surroundings you are in. In simple words, it’s our situation that disables us rather than a medical impairment. All of us will find ourselves disabled at some time, and we will need an accessible application. For example, when your hands are dirty or busy, we all use voice assistants on our phones, right? Or assume you met with an accident and broke your arm, you may have used some accessible tech. After all, we all are getting aged and our vision, auditory, and mobility sensories may become weak and we will definitely rely on bigger fonts, high contrast screens, or even screenreaders. 🙂

Old man using digital tablet

I hope now you understand the importance of creating accessible applications. The trend now I observe in low-code applications like power platform is that citizen developers originally create an app for personal use, and it’s developed from the creator’s accessibility point of view and the accessibility issues are observed only when it is shared with multiple users. Now when you create an application, please keep in mind that if not today, tomorrow someone is gonna benefit from the accessibility features you have included in the application.