CategoriesAIPower AppsPower AutomatePower Platform

Power Apps – ChatGPT Integration

In this article, let’s see how we can integrate ChatGPT with our Canvas App to add AI functionality.

ChatGPT is an artificial intelligence-based chatbot developed by OpenAI, specialized in conversing with human users. The acronym GPT stands for Generative Pre-trained Transformer, which means “pre-trained generative transformer.” With ChatGPT we can, for example, generate content, answer questions, Translate, summarize, complete sentences etc.

Feel free to write me if you need help.

Requirements

Basically, the Idea is call ChatGPT Service via Power Automate, get response and pass it to our App. Before start, you need ensure to have:

  • Premium Licence (Or Trial) to make Http Post request from Power Automate
  • An account with some cretit on OpenAI
  • Valid OpenAI API key

Build flow

In this Example, we’re going to call our flow from a Canvas App, passing a prompt and get an output. Trigger is Standard Power Apps connector:

Power Apps connector as trigger

Then, we must do an HTTP Post request to call OpenAI Service. According to Open AI documentation (at this this link) we need to specify in the following headers to make request:

  • URL: https://api.openai.com/v1/chat/completions
  • Content-Type: application/json
  • Authorization: Bearer $OPENAI_API_KEY

And as Body, a Json with:

  • Model
  • Messages
  • Temperature

Example:

{
     "model": "gpt-3.5-turbo",
     "messages": [{"role": "user", "content": "Say this is a test!"}],
     "temperature": 0.7
   }

In my case I parameterized the prompt, but of course you could also parameterize model or temperature, So, the action to call ChatGPT from flow is:

Call ChatGPT from Http Request

Now, we must get body response, parse it, extract result and pass information back to our app.

Add “Parse Json” action and use this schema (I suggest you do to first call to service and get response and then use “Generate from sample” option):

{
    "type": "object",
    "properties": {
        "id": {
            "type": "string"
        },
        "object": {
            "type": "string"
        },
        "created": {
            "type": "integer"
        },
        "model": {
            "type": "string"
        },
        "choices": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "index": {
                        "type": "integer"
                    },
                    "message": {
                        "type": "object",
                        "properties": {
                            "role": {
                                "type": "string"
                            },
                            "content": {
                                "type": "string"
                            }
                        }
                    },
                    "finish_reason": {
                        "type": "string"
                    }
                },
                "required": [
                    "index",
                    "message",
                    "finish_reason"
                ]
            }
        },
        "usage": {
            "type": "object",
            "properties": {
                "prompt_tokens": {
                    "type": "integer"
                },
                "completion_tokens": {
                    "type": "integer"
                },
                "total_tokens": {
                    "type": "integer"
                }
            }
        }
    }
}

Result:

Parse Json response

And finally, we can get result and pass it to our app. In my case, I used and expression to get first message from result, and pass it to my app:

first(body('ParseResponse')?['choices'])['message']['content']
Pass result to app

Completed flow

The completed flow:

Completed flow

Test from App

Finally, we can create an App to test it. I created a screen with two textbox , firstone for prompt and secondone for output, then I added a button to call our flow and store result in variable.

UpdateContext({ctxChatGPTResponse: ChatGPT.Run(txtChatGPTInput.Text)})

Result:

ChatGPT App

Considerations

I hope these information can help you! Leave me a comment to let me know what you think, or if you have a better idea to handle this case.

Contact me for questions! Have a nice day!

CategoriesCreator KitPower AppsPower Platform

Creator Kit – July Update

Hello, a new update of Creator Kit is availalbe. If you don’t know what Creator Kit is, you can read my article here.

Bug Fixing

Has benn fixed some bugs:

  • Breadcumbs in Custom Pages, when updates, shrinks
  • SearchBox 1.0.22 “undefined” text inside control
  • Breadcrumb problems with dynamic ItemDisplayName
  • DetailsList TotalRecords doesn’t count correctly
  • PeoplePicker.SelectedPeople JSON parsing error

New Features for Existing Components

  • Details List control – missing event to go to last page

Considerations

I hope these information can help you…Here you can find official release page on GitHub for this update.

Contact me for questions! Have a nice day!

CategoriesPower AppsPower PlatformUI

Power Apps – Preview an app

Power Apps have now a great feature that allows you to preview your app on different devices and layouts. This is an incredibly useful tool to allows us to test our apps on multiple platforms and make sure that the user experience is consistent across all of them. With this feature, developers can make sure that their apps look great no matter what device or layout they are viewed on.

Press Preview App (F5)

Play App Preview

When you click on option, you can choose Device:

Different layout and devices

Available Options:

  • Tablet Device
  • Mobile Device
  • Web View
  • Orientation Switcher

If you don’t find devices you need, you can put custom Width and Height properties.

App Preview

Enabled Preview

To enable preview, you must enable set authoring version to last one available 3.23053.23 (save and refresh app):

Enable feature

Considerations

I hope these information can help you! If you need more information, you can go here.

Contact me for questions! Have a nice day!

CategoriesPower AppsPower Platform

Power Apps – Modern Controls

If you don’t like standard canvas app control, you can enable this new (experimental) feature to enable a new set of controls , called “Modern Controls”.

NB: This is Experimental Feature, as an experimental feature, do not use it in production apps.

Modern Controls has about 13 new controls wich you can use for your applications:

Modern Controls list
Modern Controls

Enabled Modern Controls

Firs of all, you must enable set authoring version to last one available 3.23034.5 (save and refresh app):

change authorin version image
Enable Named formulas featur

Then, you should find , in experimental features, “Try out the modern controls”:

enable modern controls

Save, refresh and you should see new group of controls called “Modern Controls“.

Considerations

I hope these information can help you! I didn’t find much documentation about it at the moment I’m writing this article, I’ll add some information as soon as I find out 🙂

Contact me for questions! Have a nice day!

CategoriesCreator KitPower AppsPower Platform

Creator Kit – Library Control Errors

At the time of writing this article, when you add Library Component of Creator Kit, you may find some errors. If you don’t know what Creator Kit is, you can read my article here.

Add control to your App

Add one of Library control to your app. If you didn’t have installed Creator Kit in your environment, you can read this article to do it.

Import component
Add Panel Component
Component
Add Control To App

Let’s see how to use this control.

Errors

As you can see, now you have 10 errors on your app. All errors are relative to our Panel Control:

Errors

Our control should look like this:

Error panel in your app
Panel

How to fix it

To fix, you should follow these step:

  • Create a local copy of your control
  • Fix errors
  • Use copied control

Let’s start to create local copy. Click on Edit and then Create Copy:

Edit component
Create copy

Now you have local copy and you can fix errors:

Error panel
Control to fix

In this case (But the errors will change depending on the control you have), I fixed:

Button:

If(ThisItem.ButtonType = Primary, ColorValue(Panel_2.Theme.palette.themePrimary))

To

If(ThisItem.ButtonType = 'Microsoft.CoreControls.Button.ButtonType'.Standard, ColorValue(Panel_2.Theme.palette.themeDark))

Font:

'Segoe UI'

To

Font.'Segoe UI'
Semibold

To

FontWeight.Semibold
Transparent
Color.Transparent

Now your control should work. You should see like this:

Fixex Panel
Panel Control Fixel

We can use our version of control:

Local components

Considerations

I hope these information can help you…Here you can find official documentations on GitHub for this control.

Contact me for questions! Have a nice day!

CategoriesCreator KitPower AppsPower Platform

Creator Kit – Panel Control

Today , we’re introducing one of the “Surface” controls group of Creator Kit: “Panel Control“. Let’s see What is it and how it works. If you don’t know what Creator Kit is, you can read my article here.

Add control to your App

Before use it, you should add it to your app. If you didn’t have installed Creator Kit in your environment, you can read this article to do it.

Add Control to your App
Add Control to your App
Add Panel control
Add Panel Component

Let’s see how to use this control.

Panel Control

This control is usefull to create complex creation, edit, or management experiences of items or settings. Let’s understand how can we use it. When you add it on your app, you should see something this:

Broken Panel Control
Panel

At this time (16/04/2023) when you add Library component of Creator Kit you may find some errors. Use this link to understand how to fix it.

We should set some properties:

Items

Create Table with these attributes:

  • Title– The title of your panel
  • Subtitle– A short description under title
  • DialogWidth– (Default 400) Width of panel
  • Position– (Default Right”) You can write “Left” if you want left panel
  • Visible– True or False, to show or hide panel. I usually use a local variable to show or Hide it
  • Buttons– Table to define buttons of your panel
  • OnButtonSelect– Event to manage select event of your button
  • Theme : Property to set Json theme on controls, as you can see also in others controls of creator Kit. I usually set it when my application starts, and set it on all controls of Creator Kit who support it. You can create your theme here.

Try to put this on OnButtonSelect property:

Switch( Self.SelectedButton.Label,
  "Ok", Notify("Ok button");
);

// Closes the panel
UpdateContext({ showHideDialog: false })

Basically, if you click on “Ok” button, you’ll see Notify in this example and your then panel will hide.

Set “Visible” property:

showHideDialog

So, to show your panel, you must set true “showHideDialog” variable:

UpdateContext({ showHideDialog: true })

How to put controls inside your panel

You can’t put controls inside your Panel control, but you can use a container. Let’s se an example with Vertical container.

To align container to panel, we must set these properies , to same properties of panel:

Container PropertiesPanel Properties
XmyPanel.ContentX
YmyPanel.ContentY
WidthmyPanel.ContentWidth
HeightmyPanel.ContentHeight
VisiblemyPanel.Visible

Just to show you result, I set different background color:

Panel Control

Now you can put others controls inside container and use your panel.

Considerations

I hope these information can help you…Here you can find official documentations for this control.

Contact me for questions! Have a nice day!

CategoriesPower AppsPower Platform

Power Apps – Named Formulas

Today , I want to explain a really cool feature, in order to improve performance of your app and make it “code” more tidier.

NB: This is Experimental Feature, as an experimental feature, do not use named formulas in production apps.

We can use App.OnStart to inizializiate variables, load data and do some operations. These actions my be cause slow starting of your application. Sometimes we use , for example hidden button to write “reusable” code.

Now , we can write formulas and reuse it in any part of our application.

Enabled Named Formulas

Firs of all, you must enable experimental feature. Click on “Settings” and enable it:

Enabled named formulas
Enable Named formulas featur

Use it

Now, you should see new property of your app, called “Formulas”. Here you can add your formula!

Use named formulas
Formulas

Here you can add your formulas. For example:

ParamID = Param("ID");
UserEmail = User().Email;

But, of course, you can add more complex formula.

Advantages

Why we should use named formulas? let’s see some advantages:

  • The formula’s value is always available. There is no timing dependency, no event likes App.OnStart should be executed.
  • Formulas can be calculated in parallel.
  • The formula’s value is always up to date.
  • The formula’s definition is immutable. As opposed to variables, the definition in App.Formulas is the only “source of truth” and the value can’t be changed somewhere else in the app.
  • Calculated when needed. Value are calculated when app need it so this can improve app load time.

Considerations

I hope these information can help you! Here link with additional informations.

Contact me for questions! Have a nice day!

CategoriesCreator KitPower AppsPower Platform

Creator Kit – Nav Control

Today , we’re introducing one of the menu & nav controls group of Creator Kit: “Nav Control“. Let’s see What is it and how it works. If you don’t know what Creator Kit is, you can read my article here.

Add control to your App

Before use it, you should add it to your app. If you didn’t have installed Creator Kit in your environment, you can read this article to do it.

Add Control to your App
Add Control to your App
Add Fluent Nav Control
Add Fluent Nav Control

Let’s see how to use this control.

Nav Control

You can use this control to create a navigation menu in your app. Let’s understand how can we use it. When you add it on your app, you should see something this:

Nav Control
Nav Control

We should set some properties:

Items

Create Table with these attributes:

  • ItemDisplayName – The Display Name of the menu item
  • ItemKey – The key of item (must be unique)
  • ItemEnabled – (Default true) Set to false to disabled
  • ItemVisible – (Default true) Set to false to hide
  • ItemIconName – The Fluent UI icon to use (here you can find icons)
  • ItemIconColor – The color to render the icon as (e.g. named, rgb or hex value)
  • ItemIconOnly – (Default false) set true to hide text label
  • ItemParentKey – Render the option as child item of another option
  • ItemExpanded – Set to false or true if the group should remain collapsed or expanded respectively.

Accourding to documentation, try to put this on Items properties:

Table(
  {
      ItemKey: "1",
      ItemDisplayName: "Home",
      ItemIconName: "Home",
      ItemIconColor: "Green"
  },
  {
      ItemKey: "2",
      ItemDisplayName: "Customer",
      ItemIconName: "People",
      ItemIconColor: "Red"
  },
  {
      ItemKey: "3",
      ItemDisplayName: "Documents",
         ItemIconName: "People",
      ItemIconColor: "Grey"
  },
  {
      ItemKey: "4",
      ItemDisplayName: "Others",
         ItemIconName: "DocumentSet",
      ItemIconColor: "Grey"
  },
  {
      ItemKey: "5",
      ItemDisplayName: "Quick Reference Guide",
      ItemParentKey: "4",
      ItemIconName: "Info",
      ItemIconColor: "Grey"
  }
)

You should see this result:

Nav menu with items
Nav menu with items

OnSelect

You can use OnSelect to get selected item and do some actions like change page. As usual, Just to understand , I show selected item display name in a label:

NavMenu.Selected.ItemDisplayName

Results:

Nav Menu

Others useful properties are:

  • Theme : Property to set Json theme on controls, as you can see also in others controls of creator Kit. I usually set it when my application starts, and set it on all controls of Creator Kit who support it. You can create your theme here.
  • CollapseByDefault: You can set to True or False. Nav remain collapsed or expanded respectively. Individual Item level expand property is respected.

Considerations

I hope these information can help you…Here you can find official documentations on GitHub for this control.

Contact me for questions! Have a nice day!

CategoriesCreator KitPower AppsPower Platform

Creator Kit – November Update

Let’s see what news are introduced with november update of creator kit. If you don’t know what Creator Kit is, you can read my article here.

New Features

Have been introduced 2 new (in preview) components, SubwayNav and SpinButton:

SubwayNav Control

SpinButton Control

Let’s see a basic introduction to use these controls.

SubwayNav

You can use this control to show a wizard steps in our application. Let’s understand how can we use it. When you add it on your app, you should see something this:

SubwayNav control

We should set some properties:

Items

Set a Table , with these attributes:

  • ItemKey: Key of item
  • ItemLabel: A Display Name of item
  • ItemState: Icon of the step, it could be one of: “Current”, “Completed”, “Unsaved”, “ViewedNotCompleted”, “Error” , “WizardComplete”

Accourding to source code, try to put this on Items propertie:

Table(
    {
        ItemKey: "1",
        ItemLabel: "Step 1",
        ItemState: "Current"
    },
    {
        ItemKey: "2",
        ItemLabel: "Step 2",
        ItemState: "Completed"
    },
    {
        ItemKey: "3",
        ItemLabel: "Step 3",
        ItemState: "Unsaved"
    },
    {
        ItemKey: "4",
        ItemLabel: "Step 4",
        ItemState: "ViewedNotCompleted"
    },
    {
        ItemKey: "5",
        ItemLabel: "Step 5",
        ItemState: "Error"
    },
    {
        ItemKey: "6",
        ItemLabel: "Step 6",
        ItemState: "WizardComplete"
    }
)

You should see this result:

Steps

If you don’t want specify ItemState , you can set empty string (ItemState: “”) , and you’ll see an empty white dot.

OnSelect

You can use OnSelect to get selected item and change page to show next step of your wizard. Just to understand , in this case I saved selected step on variable (Is just an example, you can use Controlname.Selected insted):

UpdateContext({SeletectStep: Self.Selected})

And on label:

SeletectStep.ItemLabel

Results:

Other useful properties are:

  • Theme : Property to set Json theme on controls, as you can see also in others controls of creator Kit. I usually set it when my application starts, and set it on all controls of Creator Kit who support it.
  • Subway Nav State: Property to set state on entire controls. You can choose from: “None”, “Errors”, “WizardComplete”
Example of set Subway Nave state property to “WizardComplete”

SpinButton

A spin button is control to allow to add number in small steps. When you add control you should see this:

SpinButton

Principal properties:

  • Label: Usefull to show a label of control.
  • Suffix: To add suffix after value.
  • Theme: As usual, Json theme.
  • Min: Minimal value to set.
  • Max: Maximun value to set.
  • Step: Value to add or Subtracts.

Le’t see an example, I set these properties:

Properties
Results

New Features for Existing Components

About esixting control, have been added:

  • Tooltip for Icon component.
  • DelayOutput for SearchBox component.

Considerations

I hope these information can help you…Here you can find official release page on GitHub for this update.

Contact me for questions! Have a nice day!

CategoriesCreator KitPower AppsPower Platform

Creator Kit – Introduction

Today, we’re going to speak about Creator Kit. With this fantastic tool, we have possibility to create Canvas App, with professional look & feel with “Microsoft 365” Style.

What is “Cretor Kit” ?

According to Microsoft , Creator Kit consist in a series of controls , utility and templates , created to increase developer productivity.

  • All controls are base on Fluent UI Framework , here official documentations.
  • Is included Template Starter apps , to help you to explore components.

Set Up (Manually)

Follow these Steps:

Enable Power App component Framework Feature
Enable the Power Apps component framework feature

Utilization

  • Create new Canvas App
  • Click on Insert to add controls, and click on “Get more components”
Constrols List
Get more components at bottom
  • Now you can choose new component from Creator Kit and add them to your App.
Add new components
Controls of Creator Kit

Now you can see new control on control list under “Code components” group.

Flient Tag List component
Fluent Tag List control inside “Code components” group.

Some intresting components

Creator Kit contains around 24 components. You can start study from here. Most intresting component in my opinion are:

  • AutoWidthLabel is label who expand dynamically his with. You can customize his style by set this properties.
  • CommandBar classic command bar.
Command Bar
  • Nav control control to buil navigations menu for your app.
Nav Control
  • Dialog PopUp to show informations or confirm actions (For example Delete)
Modal PopUp

As I told you, there are more component and more will added every month. I’m going to create a post every month with description on new comonents.

Contact me for questions! Have a nice day!

CategoriesPower AppsPower AutomatePower Platform

Power Platform – Environment

Today, we’re going to speak about Environment. Where people starting to create App or Flow, usually, use Default Environment. But in order to have correct governance or our Power Platform solutions, a good idea (but is not only the one) is create more then one Environment. For Example Dev, Quality and Prod.

What is an “Environment” ?

According to Microsoft , and Environment is a a space to store and share data, app , flows. You can image it as a “Container”.

  • Each environment can have a single Dataverse DB (but you can create environment withoud it)
  • Default environment is Shared by all users, in my opinion you shouldn’t use it to develop critical app.

Environment types

Basically we can create 4 kinds of environment.

  • Sandbox: used for non-production environment but for developing and test. It can be reset or copy.
  • Production: used for permanent work. You need Power Apps license to create and manage it. It will provided with 1 GB database capacity.
  • Trial: used for short term testing. It will be cleaned automatically after 30 days. I usually use it to try new features. It can be create also as subscription based, and it can be conferted as production environment.
  • Developer: you can create a developer plan, follow this one.

Create new Environment

Go to Power Platform admin center: Power Platform admin center (microsoft.com) and click on “New”:

Admin Center
Create new environment

Now you can fill option and create your new environment

Create new environment
Creating

You can find usefull information here.

Contact me for questions! Have a nice day!

CategoriesPower Apps

Power Apps – PDF Function

Hello, really nice fuction under our lens today. “PDF Function”. What is this? Is an Experimental function to print Power Apps Screen as PDF.

Let’s start!

Enable functionality

First of all, you must enable this feature:

Enable PDF Function
Enable experimental feature

How can we use it?

Basically , you should call “PDF” Function and pass it information about screen to “Print” as PDF.

PDF (Screen or control name [,{Size, DPI, Margin, Orientation, ExpandContainers}])

The mandatory parameter is Screen (or control name), but you can specify Size, DPI, Margin etc.. Check documentation here.

Example

Create a form, with “print button”:

Print Screen as PDF
Print screen as PDF
Set(myPDF,JSON(PDF(Screen3))

Now, use PDFViewer control to see result:

See PDF in PDFViewer control
View PDF

Contact me for questions! Have a nice day!

CategoriesPower Apps

Power Apps – Hide navigation bar

Hello, really 30 second to understand how you can hide navigation bar for your app.

Navigation bar

When users click on link you have been shared, probably they see something like this:

App with navigation bar

As you can see, there are:

  • Your app (in this case is mobile app, but is same for tablet layout)
  • Navigation bar (with app launcher, and title of the app)

How to hide navigation bar?

Simply pass link with this query string parameter: &hidenavbar=true

App without navigation bar

Contact me for questions! Have a nice day!

CategoriesMicrosoft 365Power AppsSharePoint Online

Power Apps – Improve performance

Hello, Today I want to explain how to improve performance of yours Canvas App. Any comments, integrations or suggestions are welcome 🙂

Cache local data

Does your data chanche during session of your app? If you reply “No”, you should store your data into local variable and get record from it, instead always ask to database.

ClearCollect(CollProject,Projects_1)

PS: Keep mind delegation problem.

ClearCollect Function more informations here.

You should also cache for user data. Example, if you you email of connected user:

User().Email

Consider:

Set(UserEmail,User().Email)

Optimize OnStart Event – Concurrent

If you create and load collection on “OnStart” event (or on visibile), consider use of Concurrent Function. People tipically write this:

ClearCollect(CollProject,Projects_1);
ClearCollect(CollManager,Manager)

In this case, formula loads each tables one at a time. If you want optimize, you should write this:

Concurrent(
ClearCollect(CollProject,Projects_1),
ClearCollect(CollManager,Manager))

Now your app fetches the tables in parallel.

Use delegations

You shouden’t retrieve all data and then filter locally. Delegate data processing to data source (If is possible). See connectors documentation to learn about delegable formula.

For SharePoint check this link.

SharePoint delegation formula

For SQL Server:

SQL Server Delefation formula
Sql Server Delegation Formula

Use Indexes Column

Simple, but people sometimes forgot to set indexes on column. For SQL Server and SharePoint, check wich columns you’re using to filter, and set Index on these columns.

How to set index on SharePoint columns.

How to set index on SQL Server and Azure SQL.

Replace Defaults() with Variable

When you want to create new record in your table you , tipically you use Default() function. When you use it, there is a call to your datasource …

Defaults(Projects_1)

And Idea is store result of this function on variable, and use it instead call Default() every time:

Set(
    newProject,
    Defaults(Projects_1)
);

Debug – Monitoring Time

If you want to understand what happens “behind the scenes”, you should start a debugging session. From Power Apps portal, select your app and click Monitor:

Monitoring…

Now you can understand durations and respons size of your function to prevent performance issue.

Considerations

Check this official link for other tips .I hope this post was usefull for you.Leave me comment if you has appreciate it.

Contact me for questions! Have a nice day!

CategoriesListsMicrosoft 365Power Apps

Power Apps – Patch function

Hello, new Post Today. We’re going to understand how to use Patch function with SharePoint list. For this Example I used a “Task List” who contains text , choose , lookup and numeric columns.

Let’s see “Patch” Function.

Syntax

Patch( DataSource, BaseRecord , ChangeRecord1 ,ChangeRecord2,…)

Parameters:

  • Data source: the data source who contains your records. In our case is our SharePoint list.
  • BaseRecord : the record to update or use Defaults to create new one.
  • ChangeRecord(s): one or more record who contains properties to modify.

Pills:

  • You can use Patch tu create new record or update existing record.
  • Patch will update only specified properties, other will ignored.

Example

Here our task list:

Task list image

Create new record:

Patch(
    Tasks,
    Defaults(Tasks),
    {
        Title: "New Task",
        Description: "Our task descriptions",
        Status: {Value: "New"},
        Project: {
            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
            Id: 1,
            Value: "Project 1"
        },
        ProjectID:1000
    }
)

Key points:

  • Title and Descriptions are text field, so we should pass text value. Same for ProjectID who is Number and we must pass numeric value.
  • For Choose value, function expect record: {Value: “New”}
  • For Lookup column, we must pass record with ‘@odata.type’, Id and Value:
 '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
            Id: 1,
            Value: "Project 1"
        }

That’s all! If we want to update an existing record? You must get it and pass to patch function instead Defaults(). In this case, I used Lookup function to retrieve record to update:

LookUp(Tasks,ID=4)

So, complete code is:

Patch(
    Tasks,
    LookUp(Tasks,ID=4),
    {
        Title: "Old Task",
        Description: "Our task descriptions",
        Status: {Value: "New"},
        Project: {
            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
            Id: 1,
            Value: "Project 1"
        },
        ProjectID:2000
    }
)

This is the official link of patch function.

I hope this post should help you.

CategoriesMicrosoft 365Power Apps

Power Apps – Query String Parameter

Let’s learn how can we passing parameter to our Canvas Apps.

QUERY STRING PARAMETER

In this Example, I built a simple app to write a ticket in SharePoint List. In this case , I need to pass (from “external”) a parameter to our App, to set Ticket Type. My choose are:

  • Infrastructure
  • Software
  • Services

To achievement this, we should use “Query String” and Param Function. Query String is part of url , used to passing data to application.

Step 1 – Get query string from App

To get query string, I used param function in OnVisible event of my Screen to get date and store it on local variable. I can’t use “On Start” event of app because UpdateContext is only available while you are currently on a screen. When the OnStart code is executed no screen has loaded yet.

Code to copy:

If(
Param(“TicketType”) <> Blank(),
UpdateContext({selectedTicketType: Param(“TicketType”)}),
UpdateContext({selectedTicketType: “Infrastructure”})
);

Step 2 – Set Default Value to control

In my Example, I used a Form with SharePooint list as Datasource . My field “Ticket Type” is Choose field. To set value as default, I set Default property of datacard, only if the form is in “insert mode”. Why? because if we are in view or in edit, we need to see data of item, not our parameter. So:

Code to copy:

If(
frmCreateTicket.Mode = FormMode.New,
{
‘@odata.type’: “#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference”,
Id: 0,
Value: selectedTicketType
},
ThisItem.TicketType
)

Finally

You should call your app with query string, in my case:

https://apps.powerapps.com/play/xxx-xxx-xxx-xxx?tenantId=xxxx-xxx-xxx-xxxx&TicketType=Services

(xxxx are guid of your app and tenant id, you see it when you run an app in browser)

Have a nice day!

CategoriesPower Apps

Power Apps Co-Authoring

New usefull feature! One of Power Apps limitation was we unable to build app more than people a time. Now, we can work togheter!

Enable Co-Authoring

So how can we do that? Really simple, as I usually write into my blog… “One” minute 🙂 I suppose you’re know what is source control and you know github or Azure DevOps. In this case, I’ll you Git repo on my Azure DevOps account. If you don’t know where terms, please read here.

Let’s start!

Create news project on Azure DevOps or git repo. Create or open you existing App , and go to settings, Upcoming Features and go to Experimental tab:

Enable-git-control

Then, enable “Show the Git version control setting”. Then you can see a new Section “Git version control” , click on Connect.

git-control

And configure settings:

git-repo-configuration

Then, it ask you your credentials. Keep mind, if you’re using DevOps, in password sections, you don’t put password, but you must put your personal access token. Now it create folder for you on your git repo and push your source:

powerapp-source-control

Now you can build app with your collegue! It’s experimental but cool!

More info here.

Have a nice day

CategoriesPower Apps

Power Apps – Low code & Low risk

Good news!

Microsoft introduce new way to pay for Power Apps and related services: Pay as you go. From 2/11/21 , you can use your Azure Subcription to cover Power Apps and Dataverse cost, based on usage. In my opionion is very good feature, to allow you to try services with low risk.

See this link:

Low-code with low risk

Have a nice day

CategoriesPower AppsPowerShell

Restore deleted App

Did you deleted your App 🙂 ?

Don’t worry, in the most of case you can recover it. Let’s see how, with simple powershell command. As I usually write, if you know what you do , the script is:

Get-AdminRecoverDeletedPowerApp -EnvironmentName ‘Default-abcd1234-abcd1234-abcd1234’  -AppName ‘abcd1234-abcd1234-abcd1234-abcd1234-abcd1234’

Step to do it:

  1. Install these PowerShell Modules (You must be admin of PC):
    • Install-Module -Name Microsoft.PowerApps.Administration.PowerShell
    • Install-Module -Name Microsoft.PowerApps.PowerShell
  2. Find Environment Name:
    • Get-PowerAppEnvironment (You can get it also from url…)
  3. Find deleted App Name
    • Get-AdminDeletedPowerAppsList -EnvironmentName Default-abcd1234-abcd1234-abcd1234

Now, you can restore your app:

  1. Add-PowerAppsAccount (It open prompt to get credentials)
  2. Get-AdminRecoverDeletedPowerApp -EnvironmentName ‘Default-abcd1234-abcd1234-abcd1234’  -AppName ‘abcd1234-abcd1234-abcd1234-abcd1234-abcd1234’

I hope it help you…Have a good day!

CategoriesPower Apps

Power Apps – Date of week

Hi! let’s see a simple way to show name of day of week. There isn’t “built in function” get name, but we can use Weekday(Date) function to get numer of day and use it to show name:

Switch(
Weekday(Now()),
1, “Sunday”,
2, “Monday”,
3, “Tuesday”,
4, “Wednesday”,
5, “Thursday”,
6, “Friday”,
7, “Saturday”
)

You can change Today() with your date and get name of week.

I hope it help you…Have a good day!

CategoriesPower AppsPowerShell

Change App Owner

Let’s see how to change Power App owner.

Actually there is no possible to change it from UI. You can only add a Co-Owner user.

Fortunately we can do it with a simple PowerShell command:

Set-AdminPowerAppOwner -AppName ‘abcd1234-abcd1234-abcd1234-abcd1234-abcd1234’ -AppOwner ‘abcd1234-abcd1234-abcd1234’ -EnvironmentName ‘Default-abcd1234-abcd1234-abcd1234’

Step to do it:

  1. Install these PowerShell Modules (You must be admin of PC):
    • Install-Module -Name Microsoft.PowerApps.Administration.PowerShell
    • Install-Module -Name Microsoft.PowerApps.PowerShell
  2. Find Environment Name:
    • Get-PowerAppEnvironment
  3. Find App Name
    • Get-PowerApp ‘Name of your PowerApp’
  4. Get UserID
    • Personally I take it from Azure AD

Now, you can change Owner:

  1. Add-PowerAppsAccount (It open prompt to get credentials)
  2. Set-AdminPowerAppOwner -AppName ‘abcd1234-abcd1234-abcd1234-abcd1234-abcd1234’ -AppOwner ‘abcd1234-abcd1234-abcd1234’ -EnvironmentName ‘Default-abcd1234-abcd1234-abcd1234’

 

I hope it help you…Have a good day!

CategoriesPower Apps

Try Power Apps – Free

If you want, you can try Microsoft Power Apps for free!

As usually…it very simple:

Open this url:

Power Apps – Developer Plan

You will get following benefits:

  •  Create & test unlimited apps, with premium connectors and dataverse also
  • You can use Power Automate
  •  You can create more then one environments

All informations here:

Details

That’s all.

[/et_pb_text][/et_pb_column][/et_pb_row][/et_pb_section]

CategoriesPower Apps

Power Apps – Open External URL

How can we open external URL in Power Apps? for example another app or site?

Very simple:

“Launch” function. It need url as first (mandatory parameter) and if you need, you can also add parameters.

Example:

Launch( “https://powerapps.microsoft.com/it-it/blog/” )

Or if you need to pass parameters, one way is:

Launch( “https://www.google.com/search?”; { q: “powerapps” } )

That’s all.

CategoriesPower AppsSharePoint Online

Build an app in a few minutes

There are two ways to build an app with Power Apps. “Canvas App” (My favourite) and “Model-driven app”. In this article , let’s see how we can build an app in less then ten minutes with Canvas App, starting from data.

The fastest way

1. Start from data

We should start from data using one of connectors available, such as Excel, SQL Server, Dataverse or SharePoint.

For this article, I created a SharePoint list , starting from template “Travel requests”. The Idea is create a mobile app to allow users create travel requests.

2. Build App

Let’s build 🙂 Go to https://make.powerapps.com/ , login with our account, on “Start on data”, click on “SharePoint”:

Then, choose “Connect Directly” (In my case , I use a list on SharePoint Online):

 

Click on “Create” button, and put url of SPO Site who host our list:

Click “Go” , then choose the list, click “connect” and wait….

Now? we have our app , ready to use or customize!

Our App, is ready to use with Add, edit, delete and search functions.

I spent more time to write this article then create app 🙂

In my opinion, this is the fastest way to create a Power Apps, If you don’t like it, you can use it as starting point to learn how to build and app, or to create a poc for your users or customer.

CategoriesPower Apps

Power Apps Introduction’s

Customer’s often ask me: “What is Power Apps? What can I do with it?

“Official” reply is : “Power Apps is a suite of apps, services, connectors and data platform that provides a rapid application development environment to build custom apps for your business needs. Using Power Apps, you can quickly build custom business apps that connect to your business data….” (Here official link)

In order to make it easier to understand, my reply is:

“With Power Apps, you can build applications without being developers, integrated with different services, usable through browsers, tablets and Android or iOS Smartphones.”

Mixed-Reality-Power-Apps

Does It appear cool? Yes it do 🙂

There are many other things you can do… for example the features of Mixed Reality, or AI Builder that allows you to take advantage of artificial intelligence to extract text from an image, perform sentiment analysis, process receipts etc…

I’ll write a series of tutorials that will bring you closer to this world with very little effort.

See you soon. Stay tuney!

My Agile Privacy
This website uses technical and profiling cookies. Clicking on "Accept" authorises all profiling cookies. Clicking on "Refuse" or the X will refuse all profiling cookies. By clicking on "Customise" you can select which profiling cookies to activate.
Warning: some page functionalities could not work due to your privacy choices