PowerAutomate

Common Errors: Action ‘Initialize_ variable failed’ in parsing JSON.

In this blog we will address the common error we get while parsing JSON array in power automate. It is very common to get null values in the input files.

The first step is to create a trigger for flow. In this blog I have considered manual trigger.

We need to initialize the input variable. In our case it is Array. We can give sample values for our array as below,

The next step is to parse the JSON.

For the content we need to map the Array variable ‘ArrayParse’ that we initialized in the above step.

Click on Generate from sample. A sample JSON payload appears as below,

Click on Done.

The sample schema is generated as below,

{

    “type”: “array”,

    “items”: {

        “type”: “object”,

        “properties”: {

            “ProductName”: {

                “type”: “string”

            },

            “ProductID”: {

                “type”: “integer”

            }

        },

        “required”: [

            “ProductName”,

            “ProductID”

        ]

    }

}

Now test the flow.

We get the error Action ‘Initialize_variable’ failed,

Solution:

We need to remove the type generated by the sample schema manually,

Now the problem is resolved.

We could see the sample output successfully.

Apps, PowerApps

Set table ownership

As we all know there are 3 different types of tables in Powerapps

  1. Standard Tables – These are OOB tables included in Power platform for each environment. E.g., Business Units, Accounts, Contact. These tables can be customized. Custom tables imported as part of managed solution into specific environment are also Standard tables. These tables can be customized if the Customizable property is set to true.
  2. Managed Tables – These are tables imported as part of managed solution into specific environment. These tables cannot be customized as their Customizable property is set to false.
  3. Custom Tables – These are tables created in the environment directly with custom names. These tables can be customized further. Tables imported as part of unmanaged solution into specific environment are also custom tables. These tables can be customized if the Customizable property is set to true.

Customizing the tables depends on access privilege the user has on the respective table as well.

Table Ownership:

Table ownership is the ownership of records created under this table.

We have User or Team owned / Organization owned types which can be assigned for new tables while creation.

  • User or Team: Data belongs to a user or a team. Actions that can be performed on these rows can be controlled on a user level.
  • Organization: Data belongs to the organization. Access to the data is controlled at the organization level.

Additional table ownership,

  • None: System tables that don’t have any owner, e.g., Privilege table.
  • Business Unit. System tables are business owned. e.g., Business Unit, Calendar, Team, and Security Role tables.

These ownerships cannot be assigned by the user when creating new users.

How to assign table ownership?

Navigate to Table ->Properties->Advanced

Choose the Record ownership drop down as per the screen shot below:

Apps, Dynamics 365, PowerApps

Associate a business unit with an Azure AD security group

It is now possible to use Azure AD security group to map your business unit for streamlining your user administration and role assignment.

Create an Azure AD security group for each business unit and assign the respective business unit security role to each group team.

  1. Create a user in Microsoft Azure AD
  2. Login to portal.office.com. Navigate to Admin->Teams&groups->Security tab
  3. Click on Add a Group, Give a group name and description.
  4. Click on Create Group
  5. The group is now created.
  • Navigate to admin.powerplatform.com
  • Choose the environment->Settings->Users+Permissions->teams
  • Click on Create team.
  • Add Team Name, Business Unit, Administrator
  • Choose Team type as AAD Security group
  • Search for the team’s name we created
  • Choose the membership type from the options – Members and Guests, Members,Owners,Guest
  • Click on Next
  • Choose from Security Role that needs to be assigned to this team

Now, all users who belong to this security group will have access to this Business Unit with assigned security role.

Apps, PowerApps

How to Enable Search in Address Finder Field in Canvas PowerApps 

Implementation Steps:

1. Navigate to https://make.powerapps.com

2. Create a new Table Canvas PowerApps

3. Add Address Finder Controller from Insert

4. Preview the App

5. If will ask you to enable FULL Map access.

Let’s see how we can achieve this.

  • Navigate to Map and address services –FULL option
  • . Turn it ON and Agree Terms and Click Enable

6. Now Click Save.

7. Once Done.. Navigate to your tablet Canvas app and Refresh the Screen

8. Add the Address Control again

9. Preview the App

10. Enter the Value in the Text Box you will get the Address loaded 

:slightly_smiling_face:
Apps, PowerApps

How to Share Canvas App with Guest Users?

In this blog I will show step by step instructions on how to share canvas app with Guest Users.

Guest users can use their own Power Apps per User license to access a Canvas App in another tenant as a guest.

  • User got added successfully.
  • Navigate to https://make.powerapps.com
  • Click on the Canvas App that you want to share with Guest User.
  • Click on 3 dots->and choose share
  • Add Security Role and Share.
  • Now share the App URL to the guest user and he should be able to access the App.
  • The Guest User can access the App from his tenant and license Plan successfully.
PowerApps, PowerAutomate

Get Tweet User details from Twitter using Power Automate

In this blog, I will describe on how to use power automate to extract tweet details from Twitter page.

To start with,

  • Login to https://make.powerapps.com.
  • Navigate to Flows and create an automated cloud flow.
  • Let us use the trigger When a Tweet is posted.
  • Click on Add Connection and set the Twitter Account details which needs to tracked.
  • In the Search Text, enter the search terms – #Searchtext or “search text” or from: @username.
  • Power Automate will only trigger when the search criteria is met.

Initialize an array variable to get the User Details Array information from the Tweet.

  • Call the trigger – Get User
  • Insert user name parameter from previous step ( ‘when a new tweet is posted’)
  • Now pass information to user details array we initialized. For this we will use the action – Append to Array,
  • Test the results by passing it to a html table,
  • Lets use the create html table action and pass the array we set in the previous step with user details.
  • You can either choose the columns to be ‘Automatic’ or give custom values,

If custom value is choosen , each column name need to be created and value needs to be assigned as below,

@{variables(‘arrayname’)?[0]?[‘FieldName’]}

In our case to get full name – @{variables(‘userdetailsarray’)?[0]?[‘FullName’]}

  • Save the Flow. Now create a Tweet from associated Twitter account with the search input matching the search term specified in flow.
  • The UserDetails Array holds the following information,

The html table would appear like below,

  • Please Note : Incase location is coming as blank – make sure in Twitter User profile the location and location settings are set properly,

Complete steps for flow is as below,

PowerApps, PowerAutomate

Power Automate – Data sources using Environment Variables

In this blog , I will describe how to use environment variables to pass data sources in power automate flows.

Environment variables help us in a great way to reduce the manual association of data sources in each environment.

  • Login to https://make.powerapps.com
  • Navigate to Solutions -> Add New->More->Environment variables
  • Create an environment variable for Site .
  • Choose the Data Type – Data Source
  • Associate SharePoint connector if you have already created. Else create a connection and associate it here.
  • Choose the parameter type as ‘Site’.
  • Associate the SharePoint Site . You can pass the Default site value and a current value ( which is unique for each environment).
  • If the current value is not specified , default value will be used.
  • Once the environment variable for site is created, we need to create one more environment variable for List.
  • Follow the same steps as above and create a new environment variable,
  • Choose the Parameter Type as ‘List’.
  • Under Site , Specify the name of Environment variable we created in above step.
  • Now login to https://flows.microsoft.com
  • choose the flow that is using sharepoint list as data source or create a new flow,
  • In the Site Address – instead of specifying the URL directly choose ‘custom value’
  • Now you will observe that the environment variables are available to use in ‘Dynamic Content’
  • Use the Environment variables created for Site and List respectively,
  • This helps is deploying the Canvas Apps from one environment without manual intervention in Data source connections.
Apps, PowerApps

How to add custom themes and logo in PowerApps/Dataverse/MSCRM

In this blog, I will detail the steps on how to change the custom themes and logo in PoweApps.

  • Login to https://portal.office.com
  • Navigate to Settings->Org Settings.
  • Click on Organization Profile Tab and navigate to custom themes.

Click on Default Theme.

Enable the settings – Prevent Users from overriding their theme.

Click on Save.

Navigate to logos and upload the image ( < 10KB size).

Login to https://make.powerapps.com

Observe that the Logo appears in place of PowerApps in the header.

PowerApps, PowerAutomate

Microsoft Data verse – Create Data in Data verse from Excel using Power automate

  • Login to https://make.powerapps.com
  • Choose the environment.
  • click on Flows.
  • Choose the Instant Cloud Flow -> create a name and choose the PowerApps (V2) Trigger.
  • Add a Step and choose PowerApps as admin ->Get Apps as Admin
  • To know the Environment ID in Environment Name field ,
  • Click on Settings ->Session details->PowerApp Session Details ->Copy the value against Environment ID.
  • Add a new Action below Get Apps as Admin step -> List rows present in table.
  • Choose the Location. In my case I have kept the excel file in SharePoint.
  • Choose the Document Library, File and table name from excel file from where we need to read the data.
  • We need to loop through the list data output and create records in Data verse.
  • For this , choose the loop control Apply to Each.
  • Select the Output from previous step with ‘value’ returned from the List above.
  • Choose the Microsoft Data verse ->Add a new Row action.
  • Select the entity . In my case I am reading data from excel to create records in contact entity.
  • Map the mandatory attributes from value set to columns .
  • Save the Flow.
  • Apply the flow check and test the flow.

The Flow is complete and ready to use.

Reference to SharePoint list used in the flow,

Dynamics 365, PowerApps

Microsoft Dataverse Basics #1 : Create Custom tables in Dataverse/MSCRM

  • Login to Make.powerapps.com
  • Choose your environment
  • Navigate to Dataverse->Tables-> New Table
  • Enter the Display Name, Plural Name and Primary Field Name information.
  • Please check to enable Notes and Attachments.
  • Click on More settings to fill in Description, Table type, collaboration and Create and Update Settings.

Description : We can fill in the description about this table.

Table Type : We can choose to create the table as Activity table or Standard table.

Ownership : Ownership of the table can be at User/Teams level or Organization level.

Collaboration : We can enable Activities, feedback,Connections,Send Email, Enable SharePoint Document management setting, enable auto create teams option and queues for a table. Please note once queues are enabled , it cant be disabled.

Create and Update Settings : Enable Quick create forms, Duplicate Detection and change tracking settings for a table

Offline : Enable for Mobile phone and Dynamics 365 for outlook capabilities

Click on Create and the table gets created successfully.