Image Resizer PCF

Save Your Cloud Storage Space

Wanna save some cloud storage space? here is a PCF to Help you. Nowadays, even a budget smartphone’s camera will also capture images with 3-5 MB size. Imagine a Dynamics 365 environment with 50 users and each user saving 10 images per day.

Photo by Gustavo Fring on Pexels.com

Though we can save these images to Azure Blob or SharePoint or even purchase additional storage, in most cases these images do not need a high definition quality. The Image Resizer PCF is my attempt to resize images on the fly. This control allows you to upload multiple images to Dynamics 365 notes or email and the PCF resizes the image files before saving to dynamics 365. Watch below video to view the PCF in action.

How to configure

  • Download the managed or unmanaged solution file from Git and import to your environment.
  • Insert a section with a single column on the form.
  • Add a field you would like to use that will not be used on the form.
  • Uncheck ‘Display label on the form’ for the field.
  • Add image resizer PCF control to your field.
  • Give parameter values
    • Image Height: Height of the resized image.
    • Image Width: Width of the resized image.
    • Image Quality Percentage: Resizing quality.
  • Save and publish your changes.

Technical Details

The PCF uses React Image File Resizer to resize the images and React Drop Zone for the file upload control. For quick development, I have reused Rama Rao’s Attachment Uploader for file upload logic. There are many improvement options like image preview, on screen resizing etc. You are always welcome to branch git repo here.

Shift your focus; Upgrade yourself

Upgrade Yourself

Be it any profession, upgrading your skills is unquestionably significant. Not only does it open the door to new career opportunities, but it also helps you enhance the quality of your life. To keep myself technically updated, I have bookmarked a list of blogs and YouTube channels.. I also frequently check Feedspot’s Top 35 Microsoft Dynamics 365/CRM Blogs, which is regularly updated by the moderators. But is it enough?

For a Business Application Consultant , critical thinking is as important as software skills , and I must say that reading ‘Farnam Street’ enhances your decision-making skills. Shane Parrish who is an ex-spy, investor, and writer, improves your critical thinking ability with every post in his blog “Farnam Street”.

Why Farnam Street?

MR Shane focuses on the importance of cultivating mental models and frameworks to tackle complex issues. The blog ‘guides to decision making’ especially when you’re in a challenging situation. I must say that reading a 3-minute post on Farnam Street equals watching a week of TED or simialr videos. It simply means that you are served with the most appropriate information that you need to boost your decision-making skills regardless of your professional or skillset.

Shane Parrish urges visitors to ‘Upgrade Yourself’ and that’s one of the biggest reasons he is promoting self-betterment over classic self-help fare. He believes that being responsible to yourself is imperative and learning is one of the best investments that you can make in your life.

Photo by Pixabay on Pexels.com

Here are some other ‘Be Better’ blogs that I would recommend:

For me, learning is like entering a world of opportunities. What about you?

Do you want to be a Dynamics 365/Power Platform expert? then docs.microsoft.com is the Key.

When my colleagues are stuck on something, I always encourage them to do their best in Google search and then ask for help in the respective tech community, because good research is always important to nurture knowledge. But having said that, I always ensure that they check the Microsoft docs, if they haven’t, I suggest them to look into docs.microsoft.com.

Googling is a mandatory skill. BUT

Most developers start their career at the same pace and depend on random Google Searches. Even I started my career with a trust in blogs and communities. The blogs and videos are always helpful to make you understand the topics easily, but when you need deep technical knowledge, official documents or SDK documentation is the best source. These documents let you know the capabilities and limitations of the platform you work on.

Let’s take an example, if you are stuck at some point while using Power Apps Functions or D365APIs, what will you generally do? You might search it randomly and copy/paste the available piece of code (like we all do).

Can you imagine what can happen later to the system?

Is the code you copied supported by Microsoft?

Is it the optimal solution for your system and users?

SDK documentation is the answer to all these questions. It is your responsibility to ensure that you are not doing any unsupported customization.

We all know that the official documents are helpful but, do you know why people are not looking into these documents while working on something? It’s because we are all lazy…. These documents contain a broad range of technical information and are not as simple and easy to understand as individual blogs. But for technical knowledge and long-term future in D365 and Power Apps, it is advisable not to go with easy solutions. Reading through the official documents will definitely pay back your efforts. Once you start reading these documents and comprehend the topics, they become your true consultant.

In the start of our career, people may be short on time or lazy to check and read the SDK Documents. It wasn’t different for me either. But back in those days, I came across the blog of Ben Hosk and one of his statements struck me so hard “The CRM SDK can be stubborn, difficult, and renowned for not suffering fools gladly.” Reading this was the time when I decided to look into the Microsoft Documents along with the solutions from other Blogs and Videos available.

Now, referring the official documents for solution has more or less turned into a practice for me. If time does not permit to go through the documents, I would rather expand the deadline rather than compromise on the authenticity and quality of the solution. Moreover, I try to cover the topics during the weekend and learn something new from the official Microsoft Documents. So, if you are not familiar with these documents or fail to refer them even after knowing its benefits, it’s definitely a loss of opportunity to learn new things while at work. 

So, you should never bypass “learning something new with every customization you do”!!!!

Do You Want to Prove Your Productivity While Working from Home?

How productive are you?

When we work from home, we have enough flexibility to do our job but, are we productive enough? The luxury can turn into a missed opportunity if not done precisely.

It’s been almost two months since I wrote a blog or participated in some community activities. I was too busy with my work and passive learning. I was under the impression that I am doing great because, I am delivering more tasks, learning new things, and extending my working hours by staying awake at night. I was being extremely productive. Right?

NO, I was just killing my productivity. HOW? It’s not all about delivering more tasks, but also about completing them in budgeted time without compromising on quality.

When I looked into my work, the activity which I used to complete in an hour from office is now taking more than an hour. Initially, I thought it could be the frequent breaks, however, I gradually realized, it was not just the breaks, it was simply because my productivity was going down the scale.

Oh no!!

This is not always noticeable mainly due to relaxed timelines during the current situation, as well as increased family time and close to zero daily commute. Do not let this comfort zone control your productivity, instead, put efforts to learn new things or educate yourself during the extra hours you earned by working from home. I bet this is the right time to sharpen your actual time management skills.

Shh!!

So what it takes to improve productivity while working from home? Though I am not an expert but can surely share my experience as of what helped me…take a look:

  • Be accountable for your timelines as more open-ended schedule may lead to bad results.
  • Set up a workspace and stick to your work hours.
  • Create a to-do-list and try to stick to it.
  • Take breaks and minimize distractions to put your best effort.
  • Avoid late-night work as socializing and exercising is also important.
  • Track your working hours to understand when you are more productive.
  • Start maintaining work-life balance to make sure you are doing great in both departments.

So now, over to you! let me know if they helped…

Replacing Dialog in Model Driven Apps Part-1: Using Main Form Modal

Since the announcement of dialogue depreciation, I have been trying out different alternatives to replace dialog as I use them extensively in my projects. The first option I tried was using canvas apps as described in this post ,but I was not happy with that approach and tested other options and implemented those in my projects based on customer scenarios. I will be publishing these options as a series. This is the first post and let’s see how we can replace dialog with entity main form.

There are many gaps when we replace dialog with other alternatives, even though these gaps can be filled with workarounds, the maintainability is high when compared to a classic dialog. These issues can be handled to a great extend using main forms.

With the April 2020 preview release of the Unified Interface for model-driven apps in Power Apps you can now open a record in a dialog. The record will open in a modal dialog and users will have access to the command bar, header and tabs that you defined for the records main form.

We can us the above option replace classic dialog.

Scenario:

I have to request HR team to verify certain details about prospects, but HR team is not allowed to access contact details. I also need to capture feedback and remarks from HR team.

So I created an entity called “Requests(nj_dialoguebatchone)” , modified the main form as per my requirements and removed all the unwanted buttons using ribbon-workbench.

Next step is to call this form using JavaScript from contact form.

function loadDialogForm(executionContext) {

    formContext = executionContext.getFormContext();
    var pageInput = {
        pageType: "entityrecord",
        entityName: "nj_dialoguebatchone",
        formType:  2
// formType 2 opens a new record.
    };
    var navigationOptions = {
        target: 2,
        height: {value: 70, unit:"%"},
        width: {value: 35, unit:"%"},
        position: 1
//target: Number. Specify 2 to open the page in a dialog. 
//position:Number. Specify 1 to open the dialog in center.
    };
    Xrm.Navigation.navigateTo(pageInput, navigationOptions).then(
        function success(result) {
               
                // Handle dialog closed
        },
        function error() {
                // Handle errors
        }
    );
    

   

}

I hope the code is self explanatory, more details can be found in the following links.

Now you can bind this script with ribbon button or other form events Boom dialog is ready.

You can also use quick create forms, but main form gives you more flexibility in terms using business rule and other form level formatting and validations. You can also easily configure Workflows, FLOWS, or Plugins based on user input in this as record create and update events are available.

See the dialog in Action

P.S. Am a classic dialog fan 🙂

Aggregate Grid PCF

When you have to see the Sum, Count, AVG of numeric columns in a subgrid, what is the easiest way? Export to Excel right? Now, there is an easier way: Aggregate Grid PCF Control. View Aggregates directly from Subgrid. This PCF control will list all numeric and currency columns in the view at the footer area, you just have to select the required column. This is not a production-ready control(I wanted to give life to an idea that came in during COVID19 lockdown) you can get the source code and unmanaged solution from here.

CSS & Grid design is from hovering list By Danish Naglekar.

Let’s Learn PCF Together

After adding Aggregate Grid Control to PCF gallery, I received many LinkedIn messages saying they love to build PCFs but they cannot as they are not pro UI developers. Trust me, I am not a pro UI developer just know the basics only :(, with the help of Awsome Microsoftcommunity, I managed to build a couple of PCF controls and for the last 6 months, every month am adding a new control to the PCF gallery. So now I have started a short video series of PCF control tutorial for beginners. these are 5 mins videos released once in every 3 days covering only one point per video. Hope this will be helpful for beginners. This is my first YouTube video series so am sure there is a huge scope for improvement 😅

Toggle Next PCF Control

Community plays an important role in everyday work life, at-least fifty percentage of my D365 and power-platform knowledge is gained from community(Blogs, Videos, Forums Etc..), that is why I love being part of awesome MS community.

Recently one of my clients said he doesn’t want to use the next button in the business process flow but something similar in the form is required. I do not agree such requests but since they are not really using the business process flow, the request looked relevant. I had to show him a POC on the same day itself. This is were the community comes to help. I logged in to PCF Gallery and searched for something similar, within few seconds found this PCF mask with Fabric-UI Icons for two-option field by David Rivard.

Boom!! Cloned the git repo and POC is ready in an hour.

Added a client side script to change tab when the field value is toggled.

This is not a production ready control, its just a copy I made from a cloned Git repo.

You can get the source code from https://github.com/nijos/ToggleNext.

Hope this helps. Happy Power Building.

Smart Grid PCF

One of my customer complained during a UAT session that, it’s too difficult for her to add new record using + button in a sub-grid, as it takes her to a new record window and she has to perform too many navigation. She was happy, when I enabled the quick create forms.

But, I was not happy and I wondered why OOB editable grid is not supporting this. I thought to give it a try using PCF controls, and this is the result.

Initially, it was not easy as we need to query the metadata to get field type for each column in the view. Following are the steps to configure smartgrid.

  1. Get the solution from here
  2. Import solution
  3. Add control to sub-grid
  4. Give required parameters.
alt text
  • Primary Lookup: Logical name of the lookup field for the relationship. for example contact sub-grid in the account is “*parentcustomerid_account”.
  • Primary Entity Set: Entity set name of the current entity where the sub-grid is added

This is to set the related lookup using Web API, you can use Rest Builder to get these parameter values correctly, for example if contact sub-grid in account form is using parent customer relationship, to set the account lookup in contact following code is used var entity = {}; entity[“parentcustomerid_account@odata.bind“] = “/accounts(xxxxx-xxxx-xxxx)”;

Known bugs.

  • Does not support N:N
  • Validation for empty rows.
  • Does not support composite fields(customer lookup).
  • Poor CSS 🙂

Planned enhancements

  • Inline editing.
  • Validation for mandatory fields

This is not a perfect replacement for Quick create form, but you are always welcome to enhance and add features to Smart Grid Github Repo here.