WebApi - Execute Bound Function (RetrievePrincipalAccess) in PCF

I am current building PCF component that required me to determine if the user has specific rights to an entity before attempting to modify it. In order to do this I needed to figure out how to do an execute request for a Function bound to an Entity. The hardest part in doing all is really figuring out the parameters and parameterTypes you need to send with the request.This Microsoft article on how to Use Web API functions. The real takeaway from this article was pulling up the CDS metadata document for the system to determine the properties. Additionally the documentation for the function was also useful.https://<yourorg>$metadata This document contains the function name and their input properties.After finding the function in the document i was able to determine that I needed the following properties: entity, Target. This also gave me their Types which i could use i the parameterTypes section of the request. That being s…

PowerApps Portal - Users Can See More Than Their Assigned Web Roles Allow

Anyone who has configured the PowerApps/Adx Portal before can tell you how complicated the security mechanisms can be to configure. It’s both easy to give users to much permission or not enough.Today we learned an important lesson regarding two fields on the Web Role entity. During testing of a new app a users told us that they could see the portal edit button as well as every web page in the system, OH NO!After spending about two hours digging through the Web Role, Website Access Permission, and Web Page Access Control records we finally realized that someone had updated the Authenticated Users Role field on the Administrator Web Role to True. This field and the Anonymous Users Role field gives every portal user of that related type the Web Role without having to directly assign the Web Role to the User/Contact/Account record. Which explained why we still had admin rights even though the test Contact we were using had zero Web Roles assigned to it.I hope this saves someone out th…

Rotational Image PCF Component for Canvas Apps

This image component allows you to rotate an image to any degree unlike the Canvas image component which only allows 90, 180, or 270 degrees. Having full rotation of the image can allow you to build things such a compass or custom gauges/indicators for your application.Installation/Usage Instructions

Launch A Canvas App In Model App From SiteMap

Canvas PowerApps provide a great amount of functionality with little or no code. Many examples demonstrate how to open a Canvas App within a Model App on a specific record and pass the context of that record.What if you don’t want to open a Canvas App for a specific record? Let’s say you want to create a menu functionality for user to allow them to open other Canvas apps, or maybe you have developed a Canvas app which provides a file conversion function which doesn’t relate to records at all. It would be nice if we could easily load these types of Canvas Apps from the SiteMap. Here is how to get this done.This solution is based off the solution from Dynamict but I have made some improvement that allow you to utilize the same WebResource over and over again and also provides information from the originating Model App.Here is an example of a Canvas app I have created which will display a menu of items which the user can launch. The Canvas App is being called from the SiteMap link i…

Pass Custom Parameters To WebResource From UIC SiteMap in Dynamics

While working on creating a page to open a Canvas app full screen inside of a Model app I wanted to create a WebResource I could use over and over again. Most of the references I found showed the Canvas app name in the code which wouldn’t allow for code re-use. Instead I wanted to pass query string parameters to the WebResource so that it could get the name from the URL. The problem I ran into was with the new UCI interface and how it handles WebResources. After a bit of trial and error I found the trick was not using the WebResource type in the SiteMap editor but instead using a URL in the correct format and passing the parameters I needed within the Data parameters.Update- After working with the Maker Portal SiteMap editor I have realized that it will auto decode all of your Data parameters. Instead of using the Maker portal you will need to update the SiteMap using [XrmToolbox] or another XML Editor.Use XRMToolbox SiteMap editor to create your sub area.
Do not use the Maker Por…

Move from using Xrm.Page to formContex in UCI form based PowerApps WebResources

The usage of Xrm.Page is currently deprecated, still available due to it’s high usage, but still deprecated. When will it go away, we don’t really know yet. How then can we use it’s formContext replacement within a web resource. Well Microsoft recently added a the getContentWindow() function to the context which allows us to get the actual content of a web resource. By adding an onload function to our form and utilizing getContentWindow() we can now call javascript on our web resource and pass it the formContext. Additionally you can add the context to the window object of the web resource so that the formContext can be used throughout the lifecycle of the web resource.Here is a quick tutorial on how to pass the formContext to a WebResource on a UCI Form.
formContext in WebResource
Form OnLoad Code// This should be in a script loaded on the form. // form_onload is a handler for the form onload event. function form_onload(executionContext) { var formContext = executionContext.get…

Sparse Checkout with Git To Reduce Confusion

If you would like to make updates to the Xrm types or any others in the DefinitelyTyped project on github you can find that cloning all the types can be a real pain. This is because a typical git clone will bring down everything and having over 6 thousand directories in this project can make thigns a bit slow. Startign with Git version 2.25.0 a new feature was introduces called sparse-checkout. This feature can be used to limit what is brough down in your git requests much like a .gitignore file, in fact it even uses the same filtering formats. The benefit of using this new feature is that you don’t need to update the .gitignore file which would be tracked in the changes. Instead these options are stored in your repo settings locally and will not show up as changes to your files.Let’s take a look!Here is my types directory in DefinitelyTyped clone. You can see that there are a lot of types, over 6K in fact. Righ now every time you do a pull it can take a little while because of …