Wave2 Subgrids

2021 Wave 2 update brought in a change in the look and feel of the views in subgrids, the moment I realized that you can drag and rearrange columns in the view of subgrid I wanted this to be permanent irrespective of the resolution of the screen. What I mean is I did not want the subgrid to look like the below subgrid when I zoom into my browser.

The fix to keep the subgird as a subgrid and not make it shrink into a card format is to change the “Read Only Grid ” Properties , read more about this at – https://diyd365.com/2019/12/30/how-to-fix-the-subgrid-in-dynamics-365-ui/

But doing the above gave me the old outdated Subgrid where I was not able to rearrange columns, which meant no more drag and rearrange ability 😭😭😭

Fix // or possible workaround πŸ˜…

The most obvious solution would be to use an Editable subgrid (editable subgrids are not resolution dependent and have the drag and rearrange ability ) but lets say your client is reluctant to use editable subgrids.. well now there is a solution to this !!

Microsoft has now given us a control for “PowerApps Grids (Preview )”

Navigate to your Subgrid in the old designer format and add the above control to the subgrid after selecting the entity you would want to display in this subgrid.

The best part is !! once you add this control to the subgrid, Dynamics allows you to use a template ( for OOB entities ), so now there is no confusion regarding how to use these controls !

Adding the PowerApps Grid (Preview) to a subgrid gives you the FULL SUBGRID irrespective of the Resolution of the screen and the ability to rearrange columns on the fly !!

The Jump bar ( alphabets that are below a subgrid) can be either enabled or disabled using the Jumpbar PCF control that is depicted in the previous screenshot.

And you still have the amazing functionality to drag and re arrange columns

I hope this helps πŸ˜€!!

Run D365 WebAPI’s from PostMan Without creating an Azure AD application !

A lot of functionality lies in WebApi’s but if you are like me who shied away by looking at the docs.microsoft.com method then the below article might give you an other way to access a plethora of new features !

So let us start with what Microsoft wants us to use – in order to call these WebAPI’s you would need to have a form of Authorization, this is achieved by registering an Azure app more about this can be found at – MSDOC but this shows are really complex way to do the same thing which is spoke about at a Blog written by Dynamic Consultants Group https://dynamicconsultantsgroup.com/blogs/dynamics-365-webapi-calls-and-flow/

Although the above seems easier but it still is quite a task I would say..

So while trying to find other ways to create an Authorization token I came across something which might save someone some time in future, using this method you do not need to create an application in Azure !

Steps :

  1. Login to CRM as your user and open the development console, make sure you have a higher level system Role to get access to all entities
  2. Filter down to Fetch/XHR requests, and find a request that either uses a Get or post method to CRM ( you would find ample of these )
  3. Copy the cookie value highlighted below

Now that we have our cookie values stored in our clipboard navigate to PostMan or any other tool to call HTTP requests and add the necessary header, in our example we will be using something from MS Docs

Our API for the demo is –

POST [Organization URI]/api/data/v9.0/accounts HTTP/1.1
Content-Type: application/json; charset=utf-8
OData-MaxVersion: 4.0
OData-Version: 4.0
Accept: application/json

{
“name”: “Sample Account”,
“creditonhold”: false,
“address1_latitude”: 47.639583,
“description”: “This is the description of the sample account”,
“revenue”: 5000000,
“accountcategorycode”: 1
}

However In our header we are NOT going to use any Authorization key ! Instead we will make use of Cookie –

And Voila that works !!! So now you can run your API’s without a bearer token, however, keep in mind the cookie token does die out after a while.

In case you like this content please do put a like on the Linkedin Post !!

I hope this helps !!! πŸ˜€

Ps. The Above article was published after taking approval from Microsoft Security Research Center (MSRC )

Enable App Notifications on Org level rather than App level

This happened by mistake, but a mistake that was really beneficial !

Recently Microsoft reveled a new feature for early access but in order to use this feature you needed to run an API for an APP level

The code given by Microsoft was –

fetch(window.origin + “/api/data/v9.1/SaveSettingValue()”,{
method: “POST”,
headers: {‘Content-Type’: ‘application/json’},
body: JSON.stringify({AppUniqueName: “Your app unique name”, SettingName:”AllowNotificationsEarlyAccess”, Value: “true”})
});

https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/send-in-app-notifications#enable-in-app-notification-feature

If you struggled like me to find the exact app name #Don’t_Be_A_Karan then the next paragraph might help you a lot !

Removing the ” Unique App Name ” from the query enabled the feature on an org level !

your new code would look something like

fetch(window.origin + “/api/data/v9.1/SaveSettingValue()”,{
method: “POST”,
headers: {‘Content-Type’: ‘application/json’},
body: JSON.stringify(SettingName:”AllowNotificationsEarlyAccess”, Value: “true”})
});

The results – ALL apps get the notification icon !

In certain cases you would want to enable this on an org level rather than an app level. ( This was not mentioned in MS documentation )

Now if you are like me and went straight to the UI and tried creating a Notification record you would hit an error 9 out of 10 times

And going to power automate creates a record with a GUID but there is a Partition ID that creates an Issue

[ UPDATED After Microsoft helped me rectify this issue Click here to find the resolution to the above issue ]

if you want to try it out you can use your console of your browser –

fetch(window.origin + “/api/data/v9.0/appnotifications”,{
method: “POST”,
headers: {‘Content-Type’: ‘application/json’},
body: JSON.stringify({
“title”: “API”,
“body”: “API!”,
“ownerid@odata.bind”: “/systemusers(GUID of your user )”,
“icontype”: 100000000, // info
“toasttype”: 200000000 // timed
})
});


In case you want to disable this feature its really simple, you can use the below code in the console and perform a hard refresh !

fetch(window.origin + “/api/data/v9.1/SaveSettingValue()”,{
method: “POST”,
headers: {‘Content-Type’: ‘application/json’},
body: JSON.stringify(SettingName:”AllowNotificationsEarlyAccess”, Value: “false”})
});

I hope this helps πŸ˜€!

[FIX to the Power Automate Issue !! Thank you so much Abhishek and Adrian from Microsoft !! ]

Removing the time duration in expiry and linking the owner field to Systemusers(<unique GUID of the user >) allows the system to create notifications flawlessly !

Make sure if you are adding a duration to the expiry, add a good amount of time, something like 5-6 seconds may not work !

I hope this helps ! πŸ˜€

Difference Between SetNotification and SetFormNotification

Ever found a form with only a notification and you struggled for hours to find where that field is ? #Dont_be_a_karan

In todays short article we will walk through two Javascript Functions that are used to set functions and compare the UI

SetFormNotification : https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/formcontext-ui/setformnotification

This function creates a notification however the limitation is that there is no control on the Notification, essentially that means the user is forced to find where she/he is going wrong , now this would be great if you have a small form with lets say a single tab but this isn’t ideal if you have a form with 5 tabs..

The syntax goes as – formContext.ui.setFormNotification(errorMessagePast, “ERROR”, notificationId);

And to remove this notification the syntax goes as – formContext.ui.clearFormNotification(notificationId);

Set Notification :

https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/controls/setnotification

This is very similar to the Set form Notification however the key difference lies in the ability for the user to navigate to the problematic field. Additionally the Set notification property cannot be used to set up recommendations (INFO) or warnings.

The syntax goes as – Β formContext.getControl(“args”).setNotification(errormessage,notificationId);

And to remove this notification the syntax goes as – Β formContext.getControl(“args”).clearNotification(notificationId);

Comparing the UI of the two notifications –

If you look closely you will notice that the Set notification error highlights the field that has an error as well as the notification near the ribbon gives you the ability to navigate to the correct field where as the Set form notification error just gives you an error on the form.

Sample code – ( pre-requisite to create two fields named Set notification and Set form notification )

function sfn(executionContext) {
    var formContext = executionContext.getFormContext();
    var errorMessagePast =  "Form notification";
    var errorMessagePast1 =  "set notification";
    var y = formContext.getAttribute("kkit_setnotification");
    var notificationId1 = "_myUniqueId1";
    var x= formContext.getAttribute("kkit_setformnotification");
    var notificationId = "_myUniqueId";

        if(x.getValue()==null || y.getValue()==null)
        {
            if(x.getValue()==null && y.getValue()==null )
            {
        formContext.ui.setFormNotification(errorMessagePast, "ERROR", notificationId);
        formContext.getControl("kkit_setnotification").setNotification(errorMessagePast1,notificationId1);
            }
            if (x.getValue()!=null && y.getValue()==null )
            {
                formContext.ui.clearFormNotification(notificationId);
                formContext.getControl("kkit_setnotification").setNotification(errorMessagePast1,notificationId1);
            } 
            if( x.getValue()==null && y.getValue()!=null)
            {
                formContext.getControl("kkit_setnotification").clearNotification(notificationId1);
                formContext.ui.setformNotification(errorMessagePast, "ERROR" ,notificationId);

            }

           
         }
        else
         {
            formContext.ui.clearFormNotification(notificationId);
            formContext.getControl("kkit_setnotification").clearNotification(notificationId1);
         }
        
};

I hope this helps πŸ˜€ !

Trigger a PowerAutomate flow from a BPF Step

When I first heard of this I was curious and created an instant flow and found this as a trigger step, I quickly spun up a flow to use two parameters and went to my BPF to add this in a BPF step but even after waiting for a day I did not see it in there – #Don’t_Be_A_Karan !

MY Flow

My BPF where I did not find my flow πŸ˜₯

For some reason I was not able to find my flow, but the fix to this is really simple !! and Microsoft has this documented at – https://docs.microsoft.com/en-us/business-applications-release-notes/april19/microsoft-flow/instant-steps-business-process-flows#build-the-instant-flow

FIX –

Head over to Make.preview.powerapps and create a solution in the solution section and create a new instant flow like below ( unfortunately you cannot add an existing instant flow but are allowed to create one from scratch ! )

Created the same flow with a different name –

And after saving the flow voila !!

I hope this helps πŸ˜€!!

Wave 2 Gives a New Look to Views

Remember the time you needed to add a column to a view but were worried about spoiling the layering of the solutions so ended up using the Advance find to edit columns and create a personal view ?

Well say goodbye to this problem now !! Microsoft has made things so much easier !!

Now you can add column’s on the fly with the column editor !

Clicking on this button gives you a list of fields you would want to add as column’s

These changes are temporary and reverting to the original view is easy too !! Clicking on reset to default does the trick !

The Second amazing feature that will resolve a lot of confusion is the “Default” tag in views, the views dropdown now tell you which view is default !! Let’s compare the old UI to the New UI

Old ( The default view is highlighted )

New

The stark contrasting differences here are the tag “Default” and “Reset default view” one of the major problems I noticed prior to this was – Personal views could be set as default and users would never figure out why the view which was set as default ( from the customizations page ) wasn’t showing up as default for these users, but now you can fix this confusion up using the reset to default view button !

Last but not the least, my favorite part of this new UI is, the bulk edit experience !!

To activate bulk edit select more than 2 records and click on edit, let us compare the old UI and the new UI

Old

New


Clearly, selecting a form to bulk edit looks much neater !

I hope this helps πŸ˜€!

How to Make a Powerapp into a Page ( preview)

PowerApp Pages are finally here !! But is this purely a power app ? Well not really, first lets talk about how not to be a Karan #Don’t_be_a_karan and see what Karan did wrong, then we’ll go to what’s correct and then a way to break the system to make a PowerApp into a page ! ( my Canvas app has something that I am working on which hopefully will come out in the next blogs )



1) #Don’t_be_a_Karan

When I heard of this feature I rushed to the new app designer and searched for my Canvas app, that I was so eager to get into my Model driven app but…. it did not show up.. Later I found out that a page needed to be created separately and I could not use an existing powerapp into my Model driven app…

The difference boils down to the difference between Pages and Power apps, if you look closely you will notice pages are not considered as apps while adding them to a solution, while canvas apps are still considered as apps.

In order to use pages you would need to create a page and not a canvas app.

2) But what if you have an app that needs to be used as a page ?
Well, after a bit of digging around I found something that could by pass this difference between Powerapps and Pages.

Steps to make a powerapp into a page –
1) Add the Canvas app into a solution and export this solution

2) Unzip the downloaded file and open the customizations file Change the property for Canvas App Type originally this will be 0, change it to 2 if you want to make your canvas app into a page.

3) Compress these files into a zip folder after changing the value for canvas app type

4) Import this solution into the environment, If you had downloaded this as a managed solution you will not be able to import this to the source environment ( the environment that the canvas app was created in ) hence you will need to import this into a different environment.

5) After importing, now try to create a new Model Driven app and use the custom pages feature, you will find your app in there !!

But was this app converted into a page ? lets verify that !

Update –
Pages does not allow Screens but using a PowerApps and converting it as a page allows you to achieve this functionality LinkedIn post comments has a gif regarding this – https://www.linkedin.com/posts/karan-khosla12_how-to-make-a-powerapp-into-a-page-preview-activity-6827930554659282944-tyzS

I hope this helps πŸ˜€!

Set Auto Numbering Values to a number of your choice !

The out of the box auto numbering values for cases, orders or invoices etc, start with a number 1000 but what if you wanted it to start from 0.

Well this is possible !! I will talk about the solution first and then talk about a deprecated field that Microsoft has left in the organization entity ( table ) –

The fastest way to change these the Auto-Number value from the default value to something like the above screenshot is by using the SetAutoNumberSeed Action – MSDocumentation

To illustrate the above I have attached a screenshot below body content –

The Value is the starting value you want these Out of the box autonumbered fields to have, the Attribute name is the name of the autonumbered filed and entity name is the entity that has the field.

To call this action you would need to add the standard headers in the API call. However if you want an easier way you can call this action via PowerAutomate



Now coming to the confusion caused by the Organization entity, well the organization entity is one of my favorite entities and I will write about this entity in a different post but if you look at the below screenshot it says the currentKbNumber is 3000, this was edited by using a Patch API call to the system however it did not impact the System #Don’t_Be_A_Karan I struggled for hours on this to finally stumble on this article , where it mentions this field is now deprecated, hence any change made to this would not be of any use….

I hope this helps πŸ˜€!

Dynamics 365 Trials gets a Revamp

Trials are the best part of Dynamics ! I actually first make things on a trial before sending it out to the development environment and if you are like me and have a few trial instances then you would notice… trials.dynamics.com now takes you to –

https://dynamics.microsoft.com/en-us/dynamics-365-free-trial/

Quick tip you can also use – https://aka.ms/d365trials

The look and feel is different but the essence remains the same, selecting app based trials is picked up from the predecessor but in a new look –

Creating a trial from scratch ( without any work account ) can be done as below –

First enter a gmail/ personal email id –

Doing this would enable a “Click here” button after clicking it you would see –

Enter your Gmail ID ( which works as your work ID here ) and click on next

add the details –

Enter the correct mobile number and get the verification code

After confirming the Verification Code now create the domain address that you would want to use to login.

Now create a user with a password —

After creating a user and Singing up you would find –

Clicking Get Started would take you to the powerplatform admin center –

Notice, the Default instance is created but the trial isn’t, out here you can make a Subscription based trial with the apps of your choice.

What if you want to make a normal trial ??

Head over aka.ms/d365trials and use the onmicrosoft email address that you have just created, this way you can create a new instance with a module ( for example marketing )

The difference between the two orgs can be seen at aka.ms/ppac

I hope this helps πŸ˜€

Create your website with WordPress.com
Get started