Plugin Registration Tool | Connect to environment directly by skipping discovery

November 23, 2022 Leave a comment

If your Dynamics 365 tenant has more than 20 environments and you are tired of selecting the right environment by scrolling all over, this tip is for you.

In Plugin Registration Tool (PRT) there is an option to skip discovery during login and directly connect to your environment. Lets see how to do that.

Steps to configure Skip Discovery in PRT:

  • Go to the folder where you have downloaded the Plugin Registration Tool.
  • Open the “PluginRegistration.exe.config” xml file in an editor of your choice.
  • Under <appSettings> , uncomment the “SkipDiscovery” key.
  • Should be as below once you uncomment.
  • Save the “PluginRegistration.exe.config” file and open the Plugin Registration Tool.
  • On the ‘Login’ pane, provide credentials and make sure you uncheck “Display list of available organizations”.
  • Click ‘Login’ and you get a ‘Enter environment instance url‘ popup.
  • Provide the ‘Instance url’ of your environment to connect.
  • Click ‘Ok’ and the Plugin registration tool will directly connect to your environment thus skipping the environments discovery.

  • To get the Instance url
    • Connect to Maker Portal.
    • From ‘Settings->Session details’
    • Copy the ‘Instance url’.

🙂

[Step by Step] Power Apps | Show pop ups in Canvas App

November 15, 2022 Leave a comment

In this article lets see how to show pop-ups in Canvas Apps using Container controls. I am going to explain this topic with two different examples. A ‘Single Popup’ and ‘Dual Popup’.

Single Popup in action:

Dual Popups in action:

Now that you got an idea of the two examples, lets go ahead and learn how to build them.

Step by Step to show single popup:

  • Create a new Canvas App.
  • Add a button ‘Demo Single Popup’ to the screen to show popup.
  • To display a popup, we would need 2 Container controls.
    • First container will bring the gray out affect speeded across the screen.
    • Second container will hold the display content and acts as popup pane.
  • So add the 1st Container on the screen and spread it across the screen.
    • I’ve named the Container as ‘cont_One’.
  • In the “Fill” property of Container (i.e., cont_One), set the value as RGBA(169, 169, 169, .75)
    • RGBA(169, 169, 169, .75) gives gray out affect. You may also use your own color combination.
  • Now add the 2nd Container, by selecting the 1st Container (i.e., cont_One). Make sure you select ‘cont_One’ before adding the second container.
    • I’ve named the2nd Container as ‘cont_Two’.
  • Place the 2nd Container (i.e., cont_Two) middle of the screen and set the background color.
  • Its time to add pop up content. So, select ‘cont_Two’ and add the controls. I’ve added a Label and Button controls as shown below.
  • Now that we got the layout ready, its time to implement hide/show of popup logic.
  • As we need to show popup only on ‘Demo Single Popup’ button click, set a Boolean variable by name ‘ShowPopup‘ on ‘OnSelect’ of ‘Demo Single Popup’ button.
    • Formula : UpdateContext({ShowPopup : true});
  • Now select 1st Container (i.e., cont_One) and set ‘Visible’ as ‘ShowPopup‘ variable which we defined in the previous step.
  • As the popup should be closed on click of ‘Close’ button on 2nd Container (i.e., cont_Two), select the ‘Close’ button and on ‘OnSelect’ event, set the ShowPopup to ‘false’.
    • Formula : UpdateContext({ShowPopup: false});
  • That’s it. Play the App and you should see popup on click of ‘Demo Single Popup’ button and should close on click of ‘Close’ button.

Step by Step to show dual popup:

In the dual popup scenario, everything remains same as we did for single popup and additionally we will add a 3rd Container. Lets get started.

  • Repeat the steps you did during single popup.
    • There is a slight change than what we did in single popup demo in terms of controls.
    • I’ve added ‘Rating’ control instead of label.
  • Now that we added ‘cont_One’ and ‘cont_Two’, to get the dual popup, select ‘cont_One’ and add a new Container and name it as ‘cont_Three’
  • Place the ‘cont_Three’ on top of ‘cont_Two’ and add controls as shown below.
  • We got the layout ready, its time to implement hide/show of popup logic as below.
    • On click of ‘Demo Dual Popup’ button on main screen
      • Show ‘cont_One’.
      • Show ‘cont_Two’
      • Hide ‘cont_Three’.
    • On click of ‘Rate Us’ button of ‘cont_Two’
      • Show ‘cont_One’.
      • Hide ‘cont_Two’.
      • Show ‘cont_Three’.
    • On click of ‘Close’ button of ‘cont_Three’
      • Hide ‘cont_One’.
      • Hide ‘cont_Two’.
      • Hide ‘cont_Three’.
  • Don’t worry, if the above conditions scares you. Its easy to implement. Its how we did by defining ‘ShowPopup‘ variable in showing single popup example. Additionally we would need another variable ‘ShowDualPopup‘ for dual popup.
  • On ‘OnSelect’ event of ‘Demo Dual Popup’ button, set ‘ShowPopup‘ variable as ‘true’ and another variable ‘ShowDualPopup‘ as ‘false’.
    • Formula : UpdateContext({ShowPopup : true, ShowDualPopup:false});
  • Now select 1st Container (i.e., cont_One) and set ‘Visible’ as ‘ShowPopup‘ variable. (Refer screen from single popup example if you need help).
  • Now select 3rd Container (i.e., cont_Three) and set ‘Visible’ as ‘ShowDualPopup‘ variable.
  • As we need to show ‘cont_Three’ only on click of ‘Rate us’ button of ‘cont_Two’, on ‘OnSelect’ of ‘Rate us’ button set the ‘ShowDualPopup‘ variable to ‘true’.
    • Formula : UpdateContext({ShowDualPopup : true});
  • Important point to note is that, we dont need logic to Hide/Show ‘cont_Two’ as it gets visible when ‘cont_One’ is visible and it gets hidden when ‘cont_Three’ is visible as ‘cont_Three’ is top of ‘cont_Two’.
  • Finally, as we need to hide all the popups (i.e., cont_One and cont_Three) once you click the ‘Close’ button on ‘cont_Three’, on ‘OnSelect’ of ‘Close’ button set both ShowPopup and ShowDualPopup variables to ‘false’.
    • Formula : UpdateContext({ShowPopup:false,ShowDualPopup :false})
  • That’s all needed for dual popups. Play the App and you should see dual popups.

🙂

Power Apps | Change App Owner using Power Automate Flow

November 4, 2022 1 comment

Assume that you have a canvas app with Owner as ‘User 1’ and you would want to make ‘User 2’ as Owner of the App.

We have couple of options.

In this article lets see how to use Power Automate Flow to change the Owner. Following is how the completed flow looks like.

Key in this flow is ‘Set App Owner’ Action and following are the parameters.

NameKeyRequiredTypeDescription
Environment NameenvironmentTruestringName field of the Environment.
PowerApp NameappTruestringName field of the PowerApp.
API Versionapi-versionstringThe date value of the API version.
Content TypeContent-TypestringThe content type of the API request.
Role For Old App OwnerroleForOldAppOwnerstringThe role name for the old app owner. Choose from CanView, CanViewWithShare, or CanEdit.
New PowerApp OwnernewAppOwnerstringThe principal object ID of the new owner.

Lets see step by step process to build the flow.

Step by Step budling flow:

  • Create a new flow as shown below.
  • As mentioned, key component of this flow is ‘Set App Owner’ Action and in the next steps, we will see how to pass parameters to ‘Set App Owner’ Action.
  • First we need to capture the ‘New PowerApp Owner’ parameter which is ‘Principal object ID’ of the User.
    • Note: ‘Principal object ID’ is not GUID of ‘System User’ in Dataverse. Its Azure Active Directory ID.
  • Add a ‘Get user profile (V2)’ action of Office 365 Users connector to capture the ‘Principal object ID’ of the User.
  • Rename the ‘Get user profile (V2)’ to ‘GetUserProfile’. (Optional Step)
  • Set “User (UPN)” as the User Id of the new Owner.
  • Now add ‘Set App Owner’ action.
  • Set ‘New PowerApp Owner’ as ‘Id’ from the output of previous ‘GetUserProfile’ action.
  • For ‘Environment Name‘ parameter, go to Power Apps maker portal, open ‘Settings -> Developer resources’.
  • Copy ‘Environment ID’ and paste in ‘Environment Name‘ parameter of ‘Set App Owner’ action.
  • For ‘PowerApp Name‘ parameter, go to Power Apps maker portal, open ‘App -> Details’.
  • Copy the ‘App ID‘ and paste in ‘PowerApp Name’ parameter of ‘Set App Owner’ action.
  • For ‘Role For Old App Owner‘ parameter, either you can leave or provide ‘CanView’.
  • Leave ‘API Version‘ and ‘Content Type‘ as default.
  • You should see the flow as below once you follow all mentioned steps.
  • That’s all needed!. Run the flow and you should see the owner of the App to the new user mention in the flow.

🙂

Canvas App | Formula to combine combo box selected items

November 2, 2022 Leave a comment

In this short blog post, lets see how to write formula to combine combo box selected items in to text with a separator.

Formulas:

Single column collection:
  • If the Combo box items is a single column collection as specified below.
  • Use ‘ThisRecord.Value’ in the Concat function.
    • Formula : Concat(cmbFruits.SelectedItems,ThisRecord.Value,”,”)

Multi column collection:
  • Use ‘ThisRecord.{Attribute_Name}’ in the Concat function.
    • Formula : Concat(cmbFruitsTable.SelectedItems,ThisRecord.Name,”,”)

🙂

Dependent Assembly plug-ins| Asynchronous mode error | Expected non-empty Guid

October 28, 2022 1 comment

In one of my previous articles, I’ve explained about Dependent Assembly plug-ins using which multiple assemblies/nuget packages can be seamlessly used in a single plugin assembly.

While exploring further, I’ve noticed a behavior (Issue) that if you register plugin in ‘Asynchronous’ mode, the ‘System Job’ is failing immediately with “Expected non-empty Guid.” error.

Steps to reproduce:

  • Create a plugin project using ‘pac plugin init’ (Steps specified here).
  • Add a simple plugin class with just a tracing message.
  • Register the plugin package and a new plugin step in ‘Asynchronous’ mode.
  • As, I’ve registered the plugin on ‘PostAccountCreate’, I went ahead and created a new Account record.
  • Since its ‘Asynchronous’ plugin, checked ‘System Job’ which failed with “Expected non-empty Guid” exception.

Reason:

🙂

Azure DevOps | Marketplace tasks | A task is missing error though its installed

October 26, 2022 Leave a comment

In my Azure DevOps organization, I got “Power Platform Build Tools” tools installed from Marketplace.

However none of the ‘Power Platform’ tasks were accessible/visible in my pipelines.

While executing an existing pipelines thrown following exception.

A task is missing. The pipeline references a task called 'microsoft-IsvExpTools.PowerPlatform-BuildTools.tool-installer.PowerPlatformToolInstaller'

Reason and Fix:

  • Using ‘Market place tasks’ in Pipelines was disabled for the Organization.
  • From your Azure DevOps portal, go to Organization Settings -> Pipelines -> Settings
  • Make sure “Disable Marketplace tasks” setting is turned off.

🙂

Canvas App | Open msapp file with the new menu options

October 21, 2022 Leave a comment

Assume that someone shared you a canvas app (i.e., .msapp file) and you would want to open the .msapp file in Canvas studio.

With the new menu options steps to open a .msapp file changed a bit. There is no ‘File’ tab option to open the .msapp file as shown below.

Lets see how to open an .msapp file with new menu options.

Steps to open .msapp file:

  • Connect to Power Apps maker portal.
  • Create a new Canvas app by selecting ‘Home -> Blank app’.
  • Follow the steps shown below.

🙂

Categories: PowerApps Tags: ,

Power Platform | Office 365 Outlook Connector | REST API is not yet supported for this mailbox

October 18, 2022 Leave a comment

Other while importing a solution from market place, I had to create a Office 365 Outlook connection to complete the setup.

However got following “REST API is not yet supported for this mailbox” error while creating the connection.

Reason and fix:

Error could be because of 2 reasons

  • Missing valid license
    • Troubleshoot this by logging to https://outlook.office.com/. If you could connect, then the issue might not be with license.
    • But if you get an error similar to below while logging to https://outlook.office.com/, its because of missing a valid license.
    • Ask your Admin to grant the User with either Office 365 or Azure Active Directory Premium license.
UTC Date: 2022-10-18T09:30:08.758Z
Client Id: xxxxxxxxxxxxxxxxxxxxx
Session Id: xxxxxxxxxxxxxxxxxxxx
Client Version: 20221006031.10
BootResult: configuration
err: Microsoft.Exchange.Clients.Owa2.Server.Core.OwaUserHasNoMailboxAndNoLicenseAssignedException
esrc: StartupData
et: ServerError
estack: Error: 500
    at f (https://outlook.office.com/mail/:341:261409)    at https://outlook.office.com/mail/:341:269776
st: 500
ehk: X-OWA-Error
efe: xxxxxxxx, xxxxxxx
ebe: xxxxxxxxxxxxxx
emsg: UserHasNoMailboxAndNoLicenseAssignedError
  • Missing ‘Mail Box’ configuration
    • Make sure a Mailbox is configured for the user

🙂

Categories: PowerApps Tags: , ,

GitHub Copilot | Code suggestions

September 2, 2022 Leave a comment

If you are a developer, Isn’t the below visual is scary good? You declare a function with meaningful name and the code is ready for you as a suggestion. Say ‘Hi’ to GitHub Copilot code suggestions.

About GitHub Copilot:

  • GitHub Copilot is an AI pair programmer that offers autocomplete-style suggestions as you code.
  • It is optimized to help you write Python, JavaScript, TypeScript, Ruby, Go, C#, or C++.
  • GitHub Copilot is available as an extension in Visual Studio Code, Visual Studio, Neovim and the JetBrains suite of IDEs. For more information, see “Getting started with GitHub Copilot.”

Licensing:

  • GitHub Copilot is available to GitHub customers with a personal account on GitHub.com.
  • GitHub Copilot is free to use for verified students and maintainers of popular open source projects.
  • If you are not a student or maintainer of a popular open source project, you can try GitHub Copilot for free with a one-time 60 day trial.
  • After the free trial, you will need a paid subscription for continued use.
  • For more information, see “About billing for GitHub Copilot.”

GitHub Copilot as Visual Studio Extension:

  • You must have Visual Studio 2022 17.2 or later installed.
  • In the Visual Studio toolbar, click Extensions, then click Manage Extensions.
  • In the “Manage Extensions” window, click Visual Studio Marketplace, search for the GitHub Copilot extension, then click Download.
  • Refer link for more details.

🙂

Categories: Misc Tags: ,

[Step by Step] Dataverse | Plugins | Using Dependent Assemblies

August 30, 2022 3 comments

In this article, I am going to highlight the limitations of conventional plug-in development and how the Dependent Assemblies feature addresses those limitations.

Limitations of the conventional plugins:

As we know that the plugins can be registered only as an individual .Net assembly, we can’t include another assembly or a resource file within a plug-in.

  • For example, you may want to use Newtonsoft.Json.dll or another assembly. You may want to access a list of localized strings which is not possible using native plugin development.

Workaround to support multiple assemblies:

ILMerge
  • One way to include another assembly is to combine it into one using ILMerge.
  • While ILMerge worked for many, it was never supported by Dataverse and it didn’t always work.
  • ILMerge is no longer being maintained.
Shared Projects
  • Other approach is by using Shared Projects.
  • In Shared Projects, the unit of reuse is the source code, and the shared code is incorporated into each assembly that references the shared project.

Both ‘ILMerge’ and ‘Shared Project’ options are workarounds and not recommended. Lets see how ‘Dependent Assemblies’ addresses these gaps.

Dependent Assemblies:

  • With dependent assemblies, rather than register an individual .NET assembly, you will upload a NuGet Package that contains your plug-in assembly and any dependent assemblies.
  • Unlike ILMerge, we can also include other file resources, such as JSON files containing localized strings. This NuGet package file is stored in a new table called “PluginPackage”.

If things are unclear at this point, dont worry, I will explain step by step with 2 scenarios. But before that, lets get the prerequisites ready.

Prerequisites:

  • Visual studio 2019 or later.
  • Download latest Plugin registration tool.
  • Download and Install Power Platform CLI
    • Don’t worry if you are not familiar with Power Platform CLI. We will not use complex commands.
    • We will only use one simple command to create Plugin project template.
  • Install NuGet Package Explorer
    • This is optional but a useful tool.
  • A blank solution in your Dataverse environment.

Once you got the prerequisites, lets gets started by creating plug-in assembly project.

Create a Plug-in project:

We will create plug-in project using Power Platform CLI command. As mentioned earlier, we only use CLI to create plug-in project. Steps as follows.

  • Create a new folder and open the ‘Command Prompt’.
  • Execute “pac plugin init” command.
    • Signing plug-in assemblies is not required in ‘Dependent Assembly’.
    • You can skip signing by adding “-ss true” tag to pac plugin init command.
  • “pac plugin init” command creates a .NET Framework Class library project which looks as below.
  • Open the project using Visual Studio and build. A new NuGet package gets generated for the project.

Now that we have project created, lets proceed with our first scenario.

Scenario 1 : Using ‘Newtonsoft.Json.dll’ in Plug-in project

Lets see how easily ‘Newtonsoft.Json.dll’ can be used in our plug-in project. The scenario I am using is on pre create off Account, I am setting ‘Name’ field by parsing json string.

  • Open the plug-in project created in previous step.
  • Rename the ‘Plugin1.cs’ file to ‘PreCreateAcount.cs’.
  • Install the ‘Newtonsoft.json’ package using Nuget Package Manager.
  • Add the following code snippet which uses JsonConvert.DeserializeObject method of NewtonSoft to “PreCreateAcount.cs” file
  • Build the project.
  • Note: With ‘Dependent Assemblies’ we dont need to sign the assemblies. Signing is optional. However ‘pac plugin init‘ command signs the assembly by default. So, go to project properties and uncheck the ‘Sign the assembly’.

View your NuGet package
  • Once you build the project, as an optional step, you can NuGet Package Explorer to examine the NuGet package.
  • Little bit of Dependent Assembly back ground logic , if you are interested.
    • When you upload your NuGet package, any assemblies that contain plugin classes will be registered in PluginAssembly table and associated with the PluginPackage.
    • At runtime, Dataverse copies the contents of the NuGet package from the PluginPackage row and extracts it to the sandbox runtime.
    • This way, any dependent assemblies needed for the plug-in are available.
Deploying the nuget package:
  • Build the project and open the plug-in registration tool.
  • Use ‘Register New Package’ and map the .nupkg file which will be available under your plug-in project bin\debug folder.
  • Select the Dataverse solution which we created as part of prerequisites. You can also use any existing solution.
  • Click on ‘Import’.
  • As a next step, register a new step on Pre Account Create, like how we used to create in regular plugin registration.
  • Post step registration, your Package should look similar as below.

Test the plugin:

As we developed and registered the plug-in package, its time to test.

  • Open a new Account from and provide some name.
  • Up on save, ‘Name’ should get replaced with ‘Rajeev Pentyala’ which is what we developed in our plug-in.

Scenario 2 : Using ‘Newtonsoft.Json.dll’ in another C# project

In scenario 1, we have seen how to use ‘Newtonsoft.Json.dll’ in the same plug-in assembly project. In scenario 2, lets see how to use another project.

  • Add a new ‘Class Library’ project. I named project as ‘Helper’.
  • Install the ‘Newtonsoft.json’ package using Nuget Package Manager.
  • Rename the ‘Class1.cs’ to ‘AccountHelper.cs’
  • Add following code snippet.
  • In the plug-in assembly project, add ‘Helper’ project as a project reference.
  • In the ‘PreCreateAcount.cs’ plugin class, call the AccountHelper.GetName()
  • Build the solution.

Update the nuget package:

As we changed the logic to fetch ‘Name’ from ‘Account Helper’ and built the solution. We should go and update the Plugin package.

  • To update the Plugin Package, in the ‘Plugin Registration Tool’, go to View ->Display by Package.
  • Select the latest .nupkg file and update.
  • Note : We have to go to View ->Display by Package to delete the package.
  • Test by creating a new Account record.

Limitations:

  • A plugin package is limited to 16 MB in size or 50 assemblies.
  • Workflow extensions, also known as workflow assemblies, workflow activities or custom workflow activities are not supported.
  • On-premises environments are not supported.

Known Issues:

  • Please refer Known Issues here
  • At the time of writing this article,
    • Asynchronous plug-in steps do not work. My Article on this issue.
    • You cannot use Plug-in Profiler to debug plug-ins that are part of a plug-in package.

Hope you got some idea about ‘Dependency Assemblies’. Happy learning 🙂