Pages

Friday, September 14, 2018

Timing in PowerApps

Just for fun I tried to build a PowerApp, to be embedded in D365 FinOps, that would show some PDFs for at particular item.

I keep the PDFs in a SharePoint document library and use ItemId as a key.



And resulting the app looks like this:



Of course I need to filter the SharePoint list to only show entries related to the current item, and I added the following to OnStart of the app, like described on docs:

If(!IsBlank(Param("EntityId")), Set(FinOpsInput, Param("EntityId")), Set(FinOpsInput,""));

And here is what I have put in Items of the Gallery showing the SharePoint data:

If(!IsBlank(FinOpsInput),SortByColumns(Filter(ProductPDFs,ItemId=FinOpsInput),"ItemId",Ascending),SortByColumns(ProductPDFs,"ItemId",Ascending))

A problem I have spent hours on, was that the filtering was very flaky. Sometimes it would flicker, showing all my items and then apply the filter, and sometimes it just didn't apply the filter until I manually refreshed the list.

It seems like things run i parallel when you open an app, so it would actually start to load data from SharePoint before or while the OnStart trigger is executed. And in some cases it wouldn't know about the FinOpsInput variable yet when applying my filter.

A solution could be to add a variable to OnStart, letting you know if that is finished, and make a bogus filter until it is done. Like this:

If(!IsBlank(Param("EntityId")),Set(FinOpsInput,Param("EntityId")),Set(FinOpsInput,""));Refresh(ProductPDFs);Set(AppIsStarted, true)

And change Items of the gallery to this:
If (AppIsStarted, If(!IsBlank(FinOpsInput),SortByColumns(Filter(ProductPDFs,ItemId=FinOpsInput),"ItemId",Ascending),SortByColumns(ProductPDFs,"ItemId",Ascending)), Filter(ProductPDFs,ItemId="BOGUS"))

This video explains what you need to know to build the app

Monday, September 10, 2018

A collection of links releated to Dynamics 365 FinOps and PowerApps

A collection of links releated to Dynamics 365 FinOps and PowerApps. Please comments if I have left put something important.

Embed PowerApps apps
How to embed PowerApps in Dynamics 365 for Finance and Operations Video
Getting started with canvas apps
Sample app for looking up exchange rates
Sample app for generating product labels
PowerApps Host control
PowerApps dashboard
PowerApps Documentation
https://docs.microsoft.com/en-us/powerapps/
Environment and tenant app migration through Packaging
https://docs.microsoft.com/en-us/powerapps/administrator/environment-and-tenant-migration
Free PowerApps Plan 2 trial
PowerApps Community Plan Signup
PowerApps Community Plan Details
Environments overview
PowerApps community
Microsoft Flow community

Wednesday, September 5, 2018

Comparison of Azure prices

It just needed to do a new deployment though my Visual Studio Azure subscription, and as usual I couldn't remember the price variance between regions and types of machines.

I stumbled over this site which gives a good overview: https://azureprice.net/ 

I don't know how accurate they are, but I was able to see variances and that was what I was looking for.

Thursday, June 7, 2018

How to load all labels from a label file

Here is a small example of how to load all the labels of a particular label file, in a particular language. It takes about 6-8 seconds on my developer box to load the 122190 label from SYS.

public static void main(Args _args)
{  
    info ("Starting");
        
    ClrObject labels = new ClrObject("System.Collections.Generic.Dictionary`2[System.String,System.String]");
           
    labels = Microsoft.Dynamics.Ax.Xpp.LabelHelper::GetAllLabels('SYS', System.Globalization.CultureInfo::CurrentCulture);

    ClrObject labelsEnumerator = labels.GetEnumerator();
    while(labelsEnumerator.MoveNext())
    {
        ClrObject keyValuePair = labelsEnumerator.get_Current();

        var currentlabelId = keyValuePair.get_Key();
        var currentTxt = keyValuePair.get_Value();
    }
    info ("Done");
}


Wednesday, May 2, 2018

Need to work with or add system defined buttons on forms?

You can change the behavior of system defined buttons form, or add buttons, by subscribing to delegates from the SysSystemDefinedButons class.

The class AlertFormExtender has an example of how a button is added to the Options action pane tab.

Monday, April 30, 2018

Why you can't setup sharing of customers and vendors in 8.0

The release notes for 8.0 says that you can now share customers and vendors with the data sharing feature. But it also says: "To enable this functionality, contact your Solution Architect, who will verify that your business requirements and data volumes will be acceptable for data sharing, and then enable the sharing policies in your environment".

So what does that mean?

Microsoft has started using a "flighting" concept where they add features on a release, but keep them turned of until activated for the tenant by Microsoft. This is something you can see Microsoft check in their code.

A new isFlightEnabled method on the Global class does the work of checking if a feature is enabled or not.

If you want to cheat a bit, you could probably add an event handler to this method and return true for the feature you want to enable. I haven't tried that though.

In class SysDataSharingValidation, method validateTableCanBeSharedWithPolicy, you can see an example of how this is called:



Thursday, March 15, 2018

Lifecycle Service companion app

Here is a cool tool for LCS environment managers, written by Tomek Melissa from Microsoft.

The tool is unofficial and comes AS-IS.


https://github.com/Microsoft/2LCS/releases