Skip to main content

Posts

Showing posts from 2023

Lookup In Select of URL For Power Pages

 While working on a Power Pages implementation I was consume the Power Pages API to get a Lookup table so I could show and hide information on the form using jQuery.  One issue I was having is I couldn't get a lookup field to return even though I had it as a field in the site setting for the table and included it in the my select statement in the URL.  I kept getting an `unexpected error occurred`. This issue is caused because lookup's are made up using 3 fields. 1) Formatted Value = The information you see in the lookup field (i.e. the record name) 2) Logical Name = The table the related record is a part of 3) Id = The id of the related record In the api there is a 4th field that is returned that is the Associated Navigation Property and it is the logical name of the lookup field. When setting up our select and even saying what columns can be returned in the API, we have to think how the OData endpoint will return the data to us.  ...

Reusable Method To Get Record By Id

I have a handful of reusable code that I use when creating plugins or external process (i.e. Azure Functions) for working with DataVerse. The first one I am providing is Getting a Record By Id: 1: private static Entity GetFullRecord(string entityName, string primaryKey, Guid recordId, IOrganizationService service) 2: { 3: using (OrganizationServiceContext context = new OrganizationServiceContext(service)) 4: { 5: return (from e in context.CreateQuery(entityName) 6: where (Guid)e[primaryKey] == recordId 7: select e).Single(); 8: } 9: } entityName = The logical name of the entity primaryKey = The primary key field for the entity. If using late binding you can create this dynamically by doing: $"{target.LogicalName}id" recordId = Guid of the record to get service = Service to interact with DataVerse

Power Pages Update Last Successful Login Using JavaScript and Power Pages API

 Recently while working on a Power Pages implementation for a client, I had the requirement to show the last time a user logged in on their profile page.  I thought this would be easy to do as there is already a field on the contact record for "Last Successful Login" (      adx_identity_lastsuccessfullogin).  This use to update when a user logged in, but it appears Microsoft has removed that automation. While searching I came across a few different ways of achieving this task.  One used application insights in Azure and another one used an HTTP endpoint setup in Power Automate.  I thought, this needs to be simpler.  What I came up with is to use Liquid with JavaScript to tell if a user is logged in or not.  Then use the new Power Pages api to update the logged in users contact record to mark the last time they logged in. Here is the approach I setup: 1) Make sure you turn on the api for contact in Site Settings. 1) Link to Microsoft Do...

How to Render Raw HTML Column in View in Power Pages

 Recently I had a requirement for a client to convert their existing site over to Power Pages.  One of the items I needed to convert was a "Recent Announcements" page.  This is a pretty straightforward page with only a title of "Recent Announcements" and a grid showing the announcements.  The grid only has two columns, 'Created On' and 'Message'.  The problem I had to solve was I used the Rich Text Editor control on the 'Message' field.  This means that raw HTML was stored in the field.  Out of the box Power Pages can't render the raw HTML in the column.  This means in the Power Page would have raw HTML showing instead of a nicely formatted message.  This is easily solved with a small JavaScript function. The first thing I did was create a custom entity in DataVerse called Announcement.  Here is the layout of the fields: Changed the primary name field from 'Name' to 'Subject'. Added a multi-line text field called 'Mess...

Understanding Managed and Unmanaged Solutions in Dynamics 365

Dynamics 365, Microsoft's robust suite of business applications, boasts a myriad of features that can be customized to cater to the specific needs of any business. A vital concept to grasp when working with Dynamics 365 is the difference between managed and unmanaged solutions. This blog post aims to clarify these two types of solutions, providing a comprehensive analysis of the advantages and disadvantages of each. Unmanaged Solutions Unmanaged solutions act as a dynamic development environment, enabling direct alterations and additions to system components. They are often employed during the development and testing phase of a customization project but are equally effective when implemented in production instances, particularly for internal organizational operations. Pros of Unmanaged Solutions: Flexibility : Unmanaged solutions provide a high degree of adaptability, permitting developers to modify system components, introduce new elements, or discard those that are no longer nece...

Effective Logging in Microsoft Dynamics 365 Plugins: Best Practices and Examples

Microsoft Dynamics 365 is a powerful suite of business applications that provides organizations with tools for managing customer relationships, sales, and operations. One of the essential aspects of developing custom plugins for Dynamics 365 is proper logging to ensure smooth functionality and easy debugging. In this blog post, we'll discuss best practices for logging in Microsoft Dynamics 365 plugins and provide examples to help you implement effective logging in your custom solutions. Understanding the Plugin Trace Log Microsoft Dynamics 365 provides a built-in logging mechanism called the Plugin Trace Log. The Plugin Trace Log can be used to record custom messages, exceptions, and other information for debugging purposes. To enable the Plugin Trace Log, follow these steps: Navigate to Settings > Administration > System Settings. Under the Customization tab, locate the "Plugin and Custom Workflow Activity Tracing" section. Set the option to "All" or ...

Power Up Your Business: Power Apps, Model-Driven Apps, and Power Portals Demystified

Welcome to the wonderful world of Microsoft's Power Platform! As the digital landscape keeps evolving, so do the ways we can create and manage applications for our businesses. If you're looking to power up your business, you've come to the right place! We'll dive into the whimsical world of Power Apps, Model-Driven Apps, and Power Portals, helping you pick the right tool for the job. So, grab a cup of coffee, get comfy, and let's get started! 😃 Power Apps: Your DIY App Builder Power Apps is a low-code, drag-and-drop application builder that enables users to create custom applications for their organization without needing any fancy coding skills (1). If you're a non-developer with a brilliant app idea, Power Apps is your new best friend. It's a game changer for business users who can create mobile and desktop apps for managing data, automating processes, and connecting to various services. When to use Power Apps: You need a custom application but don't ...

Taming the Beast: Early vs. Late Binding in Microsoft Dynamics 365

 Hey there, code wranglers! Are you ready to dive deep into the fascinating world of Microsoft Dynamics 365? Today, we're going to explore the differences between Early Binding and Late Binding, two popular programming techniques that you can use to make the most out of this powerful platform. We'll compare examples, performance metrics, and development times, and we'll even sprinkle in some references for those of you hungry for more information. So let's saddle up and get started! Early Binding - A Swift Ride: Early Binding is like a well-trained horse that knows exactly where it's going. With Early Binding, you'll be working with strongly-typed classes generated from the CRM metadata. This means you'll have access to IntelliSense, making it easy to spot errors during development and reducing the time it takes to write code. Let's take a look at an example of Early Binding in action: using Microsoft.Xrm.Sdk; using Microsoft.Xrm.Sdk.Client; usi...

Navigating Microsoft Dynamics 365 Customization: Plugins vs. Azure Functions

Embarking on the Microsoft Dynamics 365 customization journey offers numerous opportunities to enhance your business processes. However, deciding between the available options, such as Plugins and Azure Functions, can be challenging. This engaging post will serve as your trusty guide, helping you choose the best option for your Dynamics 365 customization needs! The Two Customization Pathfinders: Plugin and Azure Function The Agile Plugin 🏃‍♂️ Reference: Microsoft Docs - Write a plug-in Plugins are like the swift trail runners of the Dynamics 365 customization world. They're the go-to choice for quick, real-time (synchronous), or background (asynchronous) operations that occur within the platform. They can intercept events and modify data before it's saved or displayed to the user. Choose Plugins when: You need real-time processing (synchronous) or background processing (asynchronous). You want to ensure data integrity. You need tight integration with Dynamics 365. Plugins mig...

Microsoft Dynamics 365 vs. DataVerse: Unraveling the Mysteries!

Hey there, tech enthusiasts! Today, we're diving into the magical realm of Microsoft business solutions, where two powerful forces come together to save the day. That's right; we're talking about Microsoft Dynamics 365 and DataVerse. You might be wondering, "What's the difference between these two superhero-esque solutions?" Well, buckle up, because we're about to take a fantastic voyage to find out! Section 1: Microsoft Dynamics 365 - The Multifaceted Hero Microsoft Dynamics 365 is like the Swiss Army knife of business applications. It's a suite of intelligent, interconnected, cloud-based apps that cover various aspects of your business - from sales and marketing to finance and operations. These apps are designed to work together seamlessly, helping you manage every aspect of your business more efficiently. Some of the most popular apps include: Dynamics 365 Sales - Your secret weapon for building better customer relationships!  [1] Dynamics 365 Marke...