Coalesce in Power apps – Power Platform

Hi Everyone,

As we all know how we Coalesce() function in SQL, it returns the first non-null value in a list.

For example : If we run the below query, will get the results as StatureStack.com

SELECT COALESCE(NULL, NULL, NULL, ‘StatureStack.com’, NULL, ‘mscrmtechie.blogspot.com’);

In simple words, it just returns whatever the first non-null value.

In the same way, we can use Coalecse function in Power Apps formulas as well. Today, I have two variables which has been set from different logics and I had to write the logic to get the not null value between two of them. I used below formula to get the not null value between two variables.

Coalesce(variable1, variable2, …)

Here is more information from Microsoft Docs

Hope this helps.


Happy 365’ing
Gopinath.

Call Power Automate or Microsoft Flow from JavaScript – Dynamics 365 CE

Hi Everyone,

We all know how Power Automate or Microsoft Flows are changing the way we design the things in Dynamics 365 CE. Recently, we got a requirement to call Microsoft Flow from a button click on Dynamics 365. Here is the way we did using JavaScript.

Let’s create a flow as below.

1) Take the trigger as HTTP Request received.


2) Generate Schema accordingly to your input, I just have AccountID as an Input so taken JSON as below to generate schema and declare the method as POST.
{“AccountId”: “abc”}


3) I just added one step of Variable as once the flows is triggered from the JavaScript, we can add the steps as per our requirement.


4) Save the flow and get the URL from HTTP Trigger (first step)


5) Here is the JavaScript code for calling flow.

function callFlowFromJavaScript() {
    var flowUrl = "FLOW URL";
    var input = JSON.stringify({
        "AccountId": "475b158c-541c-e511-80d3-3863bb347ba8"
    });
    var req = new XMLHttpRequest();
    req.open("POST", flowUrl, true);
    req.setRequestHeader('Content-Type', 'application/json');
    req.send(input);
}

To Configure Flow URL in a best way, you can read this Post.

Hope this helps.


Happy 365’ing
Gopinath.