Using Sort, Distinct, Filter together for combo box Items– Canvas Apps (Dataverse)


Just sharing a simple example of applying a formula to the Combo box Items property, which includes Sort, Distinct, and Filter (If).

Below is our Combo Box bound to a lookup field of type Customer. If Contact is the option selected in the radio control, we want to show Contact’s Full Name sorted else Account’s Account Name field.

If( radioBtnCustomer.Selected.Value = "Contact",
    Sort(Distinct(Filter(Contacts,Status = 'Status (Contacts)'.Active),'Full Name'),
        Value,
        SortOrder.Ascending
    ),
    Sort(Distinct(Filter(Accounts,Status = 'Status (Accounts)'.Active),'Account Name'),
        Value,
        SortOrder.Ascending
    )
)

The result –

Also to clear the selection in the combo box when the user changes the option from contact to account and vice versa we can use the Reset function.

Check the below links to learn more about working with Customer lookup –

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

Hope it helps..

Advertisements

Combo box showing blank values in case of multiple conditions – Canvas App (Dataverse)


Recently while trying to filter combo box Items we were getting the values but it was coming as blank instead of showing the name field.

Below is a sample Form – connected to Leads and Source Campaign is the combo box field (lookup to Campaign)

As we can see without applying the filter we can see the name (Display fields) populated.

Now let us try to filter it based on the Campaign Type field.

Here we have applied a single filter condition.

We can see the combo box getting filtered correctly.

Now we are introducing a variable just to filter it based on condition.

Till now filtering works as expected.

Now let us introduce else condition here.

We can see the combo box getting filtered but not showing the name field of the Campaign set as a display field. Through developer tools also, we don’t see the name returned in this case. The same is the case if we use multiple If or Switch in the formula.

The solution is to filter on Campaigns data source directly, instead of the corresponding Choice field in the Lead.

The result –

Hope it helps..

Advertisements

How to – Create Marketing form submission record through Flow (Power Automate) – Dynamics 365 Marketing


Recently we were exploring the possibility of creating a marketing form submission record through flow/custom code. Here simply creating the marketing form submission record is not enough, for it to be processed by the platform, we need to call the bound action – msdyncrm_UpdateMarketingFormSubmission with Step = Retry. (And it’s all not an officially supported scenario, so be careful)

Below is how the flow looks like

First, we create a form submission record –

After creating the form submission record, we are creating and associating the marketing field submission records with the values that we want to pass for the form – email, first name, and last name in this case.

And then eventually calling the action –msdyncrm_UpdateMarketingFormSubmission to trigger the submission (resubmit) of the form submission record.

On running the flow, we can see the record created with the status as pending.

Within a few seconds, if the input is correct, we can see the status updated as success

and the corresponding contact/lead created or updated.

Hope it helps..

Advertisements

Fixed – Global variables are not allowed in StartScreen (PowerApps / Custom Page)


Recently while working on a custom page we had a requirement to show different screens on the app start based on a choice field in the record. (The custom page was being opened from a button/command on the form)

For the custom page’s App OnStart we were first removing the curly brackets from the recordID parameter passed to set the ContractId variable followed by setting ContractRecord variable using that GUID in the LookUp function.

Below is the JavaScript used to pass the parameters to the custom page (from the command/ribbon button)

Now based on Contract Type optionset field in the Contract record we wanted to show a different screen as the start screen. However, trying to use the Global Variable in the StartScreen function gave us the error – “Global Variables are not allowed in StartScreen”

The solution here was to use the Param recordId to get the record and set the start screen accordingly in the StartScreen instead of ContractRecord global variable.

Also check  – https://debajmecrm.com/how-to-dynamically-show-the-start-screen-of-an-app-in-power-apps-canvas-apps/

Hope it helps..

 

Advertisements

How to – Handle single quote/apostrophe in Filter Rows in Power Automate (Dataverse)


Say for e.g. we have the below flow, which finds the lead having subject as “My Test’s Value”

On running it we get the below error

To make it work we can make use of replace function here.

replace(variables('Subject'),'''','''''')

= to espace

= special character

replace(variables(‘Subject’),,)

Please refer to the helpful post- https://techcommunity.microsoft.com/t5/power-apps-power-automate/how-to-handle-single-quotes-in-the-filter-property-with-get/m-p/2617747

This time it works successfully.

ChatGPT – quick to correct and give the right answer.

Hope it helps..

 

Advertisements

Use Command checker (ribbondebug=true) to identify the Ribbon Customizations Issue – Dataverse / Dynamics 365


Appending ribbondebug=true to the record’s URL adds the new Command checker button in the command bar, which could help us in troubleshooting any unexpected behavior with ribbon.

More on this – https://powerapps.microsoft.com/en-us/blog/introducing-command-checker-for-model-app-ribbons/

Recently we added one enable rule to an existing button (Go Live) in the Customer Journey table. The rule was calling a JavaScript web resource based on the security role assigned to the user hiding or showing the button on the form.

Click on the Command checker to open the window on the side pane, where we can then select our button.

In the command properties tab, we can see our custom enable rule showing an error.

Also here clicking in View rule definition solution layers provides us the detail that this rule has been added as part of an unmanaged layer.

Clicking on the Unmanaged layer further provides us with the definition of the enable rule.

Going back to the error, we figured out that the function was missing from the web resource, and adding the function fixed the issue for us.

Back in the Command checker, we can see the custom Enable Rule getting evaluated correctly.

Check the Troubleshooting Guide

Hope it helps..

Advertisements