Skip to main content

Posts

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.  The easy w
Recent posts

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 Doc On How to turn on the api 2) Make s

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 &quo

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