Showing posts with label canvas. Show all posts
Showing posts with label canvas. Show all posts

Wednesday 26 April 2023

Uploading files to a Dataverse table using the "Add picture" control in a Canvas App

Overview: I need to be able to upload pictures or an file for that matter and persist the file in a Dataverse entity.  This took me a little longer than it should have.

Notes: I added a "Add picture" control to the screen, I also added a label and a icon ro Clear the uploaded image.

I also added a save button, here I persist to a Dataverse table named "Evidence", The Evidence table has a column called "File" of type "File". The part that took me awhile in the Patch statement was getting the file into the correct format (as it is a record not a picture).  This works for any file upload but has the drawback of needing to change the lookup to "All file types".  

Friday 28 October 2022

ALM Power Platform - Problem Solving

 Use the logical name of the embedded canvas app

Problem:  I have embedded canvas apps inside a Model app that I deploy via a solution.  When I move from Development to Test, the users reported that they don't have access "This app isn't opening correctly" "It looks like you don't have access to this app."  And when I dive deeper, I see the Model app in Test is point to the Development Canvas App; not the test canvas app.

Initial Hypothesis: My thinking is that the Model App in Test is pointing to the Canvas App in Dev.  In dev, I point to the test canvas app and it works.  The workaround is to Open the managed solution in the Test environment and change the AppId  to the App Id of the canvas App in TEST.   It works but it's an awful work around.  This tells me that my App Name is not working, as the Static App name is used before the AppId (looks for the app name in the current environment) and then the AppId when the app Name doesn't resolve, I believe the app name is not working.  

I changed the AppId (to a non-existing guid) and the app wouldn't load in dev.  The app name should be the logical name and not the display name.    

"The App Name property specifies the name of the canvas app to embed. The model-driven form looks for the canvas app with the specified name in the current environment. If a canvas app with that name can't be found in the environment, the canvas app control will use the App ID to load the canvas app. Enter the App Name for an existing canvas app."  Add an embedded canvas app on a model-driven form - Power Apps | Microsoft Learn

Resolution:  Open the table > Forms > Form containing the canvas app


Or, another alternative is to use Environment variables for all the canvas AppID's and change them per DTAP environment on the deployment.

More Info:

Guidelines and troubleshooting when working with embedded canvas apps - Power Apps | Microsoft Learn - scroll to "Known issues and limitations with embedded canvas apps", "The App Name property value is missing or is incorrectly defined"

Saturday 17 September 2022

Generating a Canvas App from a Custom Connector (Open API)

Overview: The Power Platform CLI in August was updated and 1 of the new features is the ability to use the CLI command line to generate a Canvas app using an Open API as the data source.

The Power CLI supports the GET and POST endpoints.  Which is normally +85% of the endpoints anyway.  

In this post I walk thru the steps to add books using an Open API and retrieve all the books as well as the new book added.  

Solution

1. I used the free postman API endpoints (2 gets and a post) > Exported the collection

2. In Power Apps > using a Solution > Add a new Custom Connector (tip: I used Automate)> Upload from a Postman Collection > Pass in the Postman collection generated in the last step.   Save the Custom Connection as shown below.  Lastly test the Custom Connector.
3. I used Visual Studio code with the Power Platform Extension
Using the Power Platform CLI, in the terminal run ps> pac to verify the Power Platform extension is available.

// Get the environment you want to work on
ps> pac admin list

// Get the Custom Connector Name or Id you are going to base the Canvas app on
ps> pac connector list --environment a9adbbba-c45d-eac1

// Generate the msapp package
ps> pac canvas create --msapp "C:\Radimaging\BookDemo.msapp" --connector-display-name "BookDemoCN" --environment "a9adbbba-c45d"


4. Import the export Power App.  Select your environment, and create a new Canvas driven Power App.  "Open" has recently changed in the UI.


The app will get created, I had to add the Custom Connector to the App and you are ready to customise

Beware: Custom Connectors and Connection References in Managed Solutions.  It's a good idea to check they work in the deployment pipelines as the rework can be a pain.  

Summary: This is a great way to build an application quickly using the pac create.  It is a bit rough, and needs amending after import on the 3 endpoints I've used but a great start to a new feature.