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. 

Sunday 11 September 2022

Power Platform Added Features

 August/September 2022 has been a busy month for the Power Platform

Here are two experimental features I think are massive: Named formulas & ParseJSON

New upcoming feature

ParseJSON

Coauthoring improvement will also be important for enterprise development.

October 2022: 
Power Pages are now in GA (Genral Availability)
Nearly 700 Connectors
A few new features/functionality I like: 



Saturday 3 September 2022

Generating a Word Document from a Row change in Dataverse without SharePoint

Problem:  Dataverse/Dynamics has a great way to generate Word or Excel documents in Model apps using the UI.  I want to generate a generate letter from a CDS entity/Table when the status changes.  And I'm not allowed to use OneDrive/SharePoint (governance restriction).

High-Level Steps:

1. Create Dataverse Table - ensure "Notes" & "Business process flows" are enabled

2. Generate the Word Template & add it to the "Template View"

Generate Word Template with dynamic column vals
Add Template

3. Create a Process to generate the output/docx from the Word template i.e. generate when status of the row changes


Activate the Workflow
4. Use Power Automate to call the Dynamics Process


Sunday 28 August 2022

Custom HTTP connector in Power automate to POST x-www-form-urlencoded data

Problem:  As part of my OAuth process I need to swap and authorisation code for an Access Token using an API, the issue is that I need to get the token into PowerApps.  

Initial Hypothesis:  Initially I created an Azure Function that does the API post as it was the easiest.  But I reverted and thought it must be easier for me to have fewer working parts and as my solution used Power Automate and I've previously used Power Automate with the HTTP custom connector I'd use the same approach.  It proved fairly tricky to get the HTTP connector to work but with some playing around and clarification of my thinking it became rather straight forward.

Firstly, I need to ensure the API is working, so I use Postman:

Postman POST request using form-urlencoded.

When I get the 200 response, I wanted to see the underlying HTTP traffic so I opened Fiddler:

Solution: From the raw HTTP trace, I realised I needed to post the body in Power Automate in the correct format.  Key value pairs for parameters and separate with an Ampersand.  Also, Url's need to be escaped/encodes, in C# there are functions to encode and decode.  I needed to do the encoding using Find() and Replace() methods (sic).  From Power Automate, I return the Access token, refresh token and other info back to Power Apps.

More Info:

Uri.UnescapeDataString(String) Method (System) | Microsoft Docs

Understanding HTML Form Encoding: URL Encoded and Multipart Forms - DEV Community

Saturday 13 August 2022

Enterprise Canvas App Development - Overview

Overview:   It is a good idea to have an agreed set of standards in an organisation and within the development teams.  Microsoft has Power App Canvas Coding standards and guidelines, use this as a base.

At a high level, the design and implementation needs to consider:

  • Security,
  • Usability,
  • Performance,
  • Maintainability & support, and
  • Accessibility.

Governance:

  • What connectors can the business use, 
  • Groups of users (who can do what),
  • Licencing,
  • Enforcement of coding standards
  • Monitoring & support

Also see: App Insights for Power Platform - Part 3 - Canvas App Logging (Instrumentation key)

WIP

<Add coding standards for Power Apps and Power Automate>

Saturday 6 August 2022

Dynamics 365 CE Intro

Overview: Dynamics 365 CE (Customer Engagement) is a subset of the Power Platform and Dataverse.  It provides commonly used entities such as Accounts and Contacts.  There are five apps that can add specific CRM functionality.  It is Microsoft's CRM solution.

There are 4 core subject (model) apps in Dynamics 365 CE

  1. Sales (MB-210) - client management including leads and turning:
    1.  leads (Qualify step) into an 
    2.  opportunity (Develop step), goes to the 
    3.  Proposal step consists of generating quote, revising quote, marking acceptance, and invoice, 
    4. Order created/lost (Closed step).
  2. Marketing (MB-220) - Lead generation & qualification, turn prospects in customers.  Build campaigns to market your business.  Email, social media, content creation to convert leads.  Ensure you target the right audience using the correct channels and breaking leads into segments.  I have only used this lightly and it is powerful.  Events are useful for planning such as speakers and managing leads/event analytics. Referred to as Dynamics 365 MarketingCustomer Voice integrates with Marketing, e.g., embed survey sent our via email.
  3. Customer Service (MB-230)/Customer support - Dynamics 365 Customer Service - Low tough Customer Experience(Cx) and it also provides for high tough as needs demand, provides omnichannel options, chatbot, email, SMS, service requests, wiki's, phone in.  Case management, raise record, route to where can be solved, and get to answer.
  4. Field Service (MB-240) - Dynamics 365 Field Service.  Send people out to customer sites, schedule, ensure technician has work order and materials to complete the job.  

Common Data Model - Agreed between various companies including Microsoft so there is a set schema that we use as a base for our businesses.  Example entities:

  • Account - Company or individual (I think of this as a legal entity).  Accounts have a primary contact, can have multiple contacts per account.  Accounts can have parent accounts.
  • Contact - is a person, can belong to multiple account.
LinkedIn Sales Navigator - Sync LinkedIn, so a contact changes, can be pulled into dynamics.  Messages from Linked in are tract in dynamics.

Dynamics 365 Sales Insights - understand your relationships, and evaluate activities.

Dynamics 365 Customer Service / Customer Service Hub
    1) Raise a case via most suitable formats (align with SLA), 
    2) route case (align with SLA) e.g.,  
    3) Enter research such as calling customer, spoke to colleague against, knowledge base against the case.  Lastly, can record fix e.g., called customer and walked them thru steps, and problem resolved
    4) Close Case (includes reason)
Customer Service Notes
  • Allows to integrate with other tools, ....
  • Knowledge management - write articles in knowledge base (KB), submit for review, all staff can search to find fixes/info.  Can also import from SharePoint, EpiServer, Wordpress and others into KB.
  • Omnichannel - communication with customer on multiple channels e.g., Teams, SMS, virtual agent, social media. Hook into external channels also.
  • Analytics - measure customer service activity.  Show kpi's to show emerging topics, agent performance, how quickly cases are being resolved.
  • Also has remote device management.
Dynamics 365 Field Service - Deliver on site service & manage workforce example is plumbing business or mining machinery maintenance.  Importantly deals with scheduling & work orders.  Deploy, fix issues/perform work from work order, the audit completion.

Note: MB-910 exam covers Dynamics 365 CE solutions.  It is a simple exam that does not require annual renewal and gives the hold CRM Dynamics Fundamentals Status.  The MB-210 specialises in the Dynamics 365 Sales and provides a Associate status which needs to be renewed annually with Microsoft. 

There are specific solutions focusing on ERP (Think SAP (Enterprise), Oracle/JD Edwards (enterprise), Baan now Infor, Sage(small-medium), Dynamics 365 (small to medium), Workday (seems to be everywhere lately) ) focus on areas like Finance, Operations, Supply chain management, Machine maintenance.  MB-920 covers the ERP fundamentals certification.

Tuesday 2 August 2022

Dealing with JSON strings in Power Apps

Overview: I get a JSON string representing an object into Power Apps.  I want to extract the values so i can use them in PowerApps.  Since this post, the ParseJson function was release in Power Apps, use that instead.

Tip: The is a great website for looking at JSON.  Otherwise I tend to use VS code.

Possible Solutions:  

  1. In Power Automate, split up the JSON (using ParseJSON) and return multiple Power Apps variables - only useful is you need a small specific subset of the JSON data.
  2. In Power Apps, use string manipulations to extract data as shown here:

Thoughts: I feel this is a big challenge for NoCode/LowCode solutions like Power Platform, it can be overcome with a little jiggery-pokery but I feel the PowerFx language should have an ability to cast JSON into an object and in turn allow object arrays in collections.  A lot of people have been asking for this on UserVoice.

Update: Sept 2022

The ParseJSON function is now in Power Canvas Apps, a huge improvement.  There is still an issue, the ParseJSON in not strongly typed, so it's still hard to deal with complex objects containing arrays in Canvas Apps.  Ideally I'd like to be able to add a schema to run against the untyped object to have a strongly type object to work with.