Set DefaultSelectedItems of Combobox on App OnStart – Custom Page -Power Apps (Dataverse)


Recently in one of our custom pages, we had to set the default value (DefaultSelectedItems) of the combo box based on one of the lookup fields on the record. We were opening the custom page from the ribbon button on the form.

Below is our function to pass the record’s GUID to the custom page from the button.


    openSearchCustomPage: function (primaryControl, firstPrimaryItemId) {
        var pageInputCustom = {
            pageType: 'custom',
            name: 'custom_searchproduct_570ed',
            entityName: 'lead',
            recordId: firstPrimaryItemId
        };

        var navigationOptions = {
            target: 2,
            position: 1,
            width: 1350
        };

        Xrm.Navigation.navigateTo(pageInputCustom, navigationOptions).then(
            function success(result) {
                console.log(result);
            },
            function error(error) {
                console.log(error);
            }
        );
    }

Next in App’s OnStart, we are setting the GUID of the record to a variable first, and than setting another variable to store the GUID of the Region lookup field on that record.

// text variable passed by the form / webresource/ ribbon
Set(varEnquiryIdWithoutCurlyBraces,GUID(Substitute(Substitute(Param("recordId"),"{",""),"}","")));

// get the Region Of Interest from the Lead / Enquiry ID
// If value present use it for prefiltering the Gallery Items
Set(varRegionOfInterest,LookUp(Enquiries,Lead=varEnquiryIdWithoutCurlyBraces, 'Region of Interest'));

And lastly, for the combo box (Items = Region (custom table)), we are setting the DefaultSelectedItems as follows

LookUp(Regions,Region=varRegionOfInterest.Region)

We also tried using the Filter option, but it was giving incorrect values.

The value on the form –

The value in the Custom Page –

Correct value populated for combo box Region, and incorrect for the one using Filter formula

Hope it helps..

Advertisements

Fixed – Expected non-empty Guid while importing solution in Dynamics 365/ Dataverse


While trying to import the solution (patch), we were getting the below error.

“Expected non-empty Guid”

There was hardly any detail in the log file also

We tried removing the solution component one by one in our source environment and trying the import again in the target environment.

Eventually removing the Pages (custom page) allowed us to import the solution successfully into the target environment.

We then compared the customization.xml of the current solution with the backup solution of the Target and see the information missing in the current solution.

Left is – Current solution (giving error) and Right is the backup solution of the target.

Interestingly next time when we extracted the new patch after a couple of days, we could see the tag there and so no issues that time.

Hope it helps.

Advertisements

How to – set Calendar View to start the week from Monday – Dynamics 365


By default, if the calendar view is starting on Sunday for the week as shown below, we can update the system settings, to start it on Monday or any other day

From Administration >> System Settings > > Formats >> Customize (Current Format)

Specify the First Day of Week

On update, we can see the view updated to show the week starting from Monday.

Hope it helps..

Advertisements

Fix – Missing dependencies error while importing solution (Dynamics 365)


Recently while importing the solution in our UAT we got the below error –

It was showing the above entity relationships missing in the solution. We could not find them inside the Power Apps Maker Portal, to add them in the source solution.

Interestingly enough we were able to find them from the classic solution explorer.

Adding them to the source solution and trying the import fixed the issue for us.

Hope it helps..

Advertisements

Using Customer Lookup in Canvas Apps (Dataverse)


For this example, we are taking the Company Name customer lookup column of the contact table.

We start by adding the Customer Name field to the form.

That adds a card to the form, let us add the required controls to get it working

Radio Button, Combo box, and Text Label for the combo box.

Change the Items property of the radio button to show the contact and account option.

Also, change the Layout to Horizontal and Default as Contact.

And set the Items property of the Combo box as below –

Based on the value selected in the radio button, we are setting the Data Source and also applying the Sort and Distinct function to it, along with StartsWith for delegation.

We have also set Allow searching as On for the combo box.

For the Contact option selected –

For the Account option selected –

Also, we can set the OnChange property of the radio button to Reset(comboControl) to clear the selection when the user switches between Contact and Account options.

Now to have this value saved back we can specify the Update property of the custom data card in which we have placed these controls.

References –

https://www.youtube.com/watch?v=y-VvNDwy_Jw&t=1191s

https://debajmecrm.com/configure-customer-lookup-to-show-either-contacts-or-accounts-in-canvas-apps/

https://learn.microsoft.com/en-us/power-apps/maker/canvas-apps/working-with-references#show-the-columns-of-a-customer

Hope it helps..

Advertisements

Fixed – Canvas App / Custom Page not showing data (Dataverse / PowerApps)


Recently we faced an issue wherein the custom page was not loading any data, however, it was working for users with the System Administrator role.

The gallery control shows the Product details.

There were no errors in the Developer Tools, we tried by giving all Organization level rights to the users on the tables involved etc. but that didn’t help.

Eventually, it all came down to this particular line in the formula used for the Items property of the Gallery Control i.e. Asset Status field (custom field).

We had a field security profile created which had Read set as No and the users were part of that security profile, which explained why it was only working for System Admin users.

Changing the Read access to Yes for that column fixed the issue for us.

Hope it helps..

Advertisements