Have you ever got a requirement to find the user role before running any logic using workflows, then this post is for you. Please continue reading.
If suppose, you got to have to run a workflow to validate some of the business scenarios using a workflow, then verifying the logged in user role is not possible using OOB workflow. In this case, you would need to get this up and running with the help of Custom workflow at first place and once the role is verified, you would need to trigger your OOB workflow logic.
Custom workflow design: The custom workflow accepts an mandatory output parameter which returns a bool value if the logged in user security role matches.
The code can be found at my GIT Hub, please check it out in case you want to implement the same requirement, you can pass in the input parameters or add any additional output parameters according to your business needs.
Then you would need build this assembly by signing it, next part would be to register in your CRM with the help of Plugin registration tool.
Later you can refer the same library in your OOB workflow as below..
And you nailed it…that’s it for today, please stay tuned and be safe..
Microsoft Power Fx is an open-source programming language that hopes to make coding as straightforward as building a spreadsheet. Wondered why Microsoft is bringing this excel backbone language to Power Platform range of Products & Services.
It is planned to expand Power Fx throughout the Power Platform over the next two years, including model-driven Power Apps, Microsoft Dataverse and Power Virtual Agents, Microsoft’s low-code chatbot platform. Developers will also be able to use it to directly edit apps in text editors like Visual Studio Code.
So Power Fx is the new name for the formula language for canvas apps. It’s a general-purpose, strong-typed, declarative, and functional programming language. Power Fx will be made available as open-source software. And source code can be found at this link..
When a formula is modified or a value is entered, the worksheet is immediately recalculated to reflect the changes.
Let’s look more in-depth at all the things that Power Fx is doing for us and the freedom it has to optimize because the formula was declarative:
Asynchronous: All data operations in Power Fx are asynchronous. The maker doesn’t need to specify this, nor does the maker need to synchronize operations after the call is over. The maker doesn’t need to be aware of this concept at all, they don’t need to know what a promise or lambda function is.
Local and remote: Power Fx uses the same syntax and functions for data that’s local in-memory and remote in a database or service. The user need not think about this distinction. Power Fx automatically delegates what it can to the server, to process filters and sorts there more efficiently.
Relational data: Orders and Customers are two different tables, with a many-to-one relationship. The OData query requires an “$expand” with knowledge of the foreign key, similar to a Join in SQL. The formula has none of this; in fact, database keys are another concept the maker doesn’t need to know about. The maker can use simple dot notation to access the entire graph of relationships from a record.
Projection: When writing a query, many developers write select * from table, which brings back all the columns of data. Power Fx analyzes all the columns that are used through the entire app, even across formula dependencies. Projection is automatically optimized and, again, a maker doesn’t need to know what “projection” means.
Retrieve only what is needed: In this example, the LookUp function implies that only one record should be retrieved and that’s all that’s returned. If more records are requested by using the Filter function—for which thousands of records might qualify—only a single page of data is returned at a time, on the order of 100 records per page. The user must gesture through a gallery or data table to see more data, and it will automatically be brought in for them. The maker can reason about large sets of data without needing to think about limiting data requests to manageable chunks.
Runs only when needed: We defined a formula for the Text property of the label control. As the variable selected changes, the LookUp is automatically recalculated and the label is updated. The maker didn’t need to write an OnChange handler for Selection, and didn’t need to remember that this label is dependent upon it. This is declarative programming, as discussed earlier: the maker specified what they wanted to have in the label, not how or when it should be fetched. If this label isn’t visible because it’s on a screen that isn’t visible, or its Visible property is false, we can defer this calculation until the label is visible and effectively eliminate it if that rarely happens.
Excel syntax translation: Excel is used by many users, most of whom know that the ampersand (&) is used for string concatenation. JavaScript uses a plus sign (+), and other languages use a dot (.).
Display names and localization: First Name is used in the Power Fx formula while nwind_firstname is used in the JavaScript equivalent. In Microsoft Dataverse and SharePoint, there’s a display name for columns and tables in addition to a unique logical name. The display names are often much more user-friendly, as in this case, but they have another important quality in that they can be localized. If you have a multilingual team, each team member can see table and field names in their own language. In all use cases, Power Fx makes sure that the correct logical name is sent to the database automatically.
These no-code tools have been built to read and write Power Fx to ensure that there’s plenty of headroom for someone to take it further.
Now lets see what’s in there for developers here…
Professionals want to use professional tools to be most productive. Power Fx formulas can be stored in YAML source files, which are easy to edit with Visual Studio Code, Visual Studio, or any other text editor and enable Power Fx to be put under source control with GitHub, Azure DevOps, or any other source code control system. Take a look at below…
What a cool feature that Microsoft introduced all the excel functions and formulas to make low code apps. much easier ..if you want to further read regarding this…Microsoft Learn is the right place…this link can take you there…
Edit: 20/02/2022
Checkout the below image to see how power fx# reduces the length of code, a developer need to write…
Of late, I have been working on various reporting requirements for a perfect CRM Solution. Here are my top tips when working on reports including SSRS, RDLC & Power BI Reports. This should be addition to my previous blog post on SSRS Tips..
Firstly once your reporting requirements are confirmed, you should make a plan to make your achieve your goal
Most viable way of creating reports is through the SSRS which comes by default to Dynamics.
But it is often argued that SSRS alone will not be sufficient to fulfill our reporting needs and we should think of the alternatives like RDLC(.net way) or Power BI(make sure you have enough Power BI licenses to use).
Power BI is ideal way if you want to know the hidden functionality of Dynamics, ex. goals, rollup queries…etc, you can easily get the fetch xml being used by CRM.
If we want to built some custom ones, make sure you do checkout the RDLC format where you could write some .net coding and achieve the required data in the report.
You can checkout the RDLC Report source code here…
This post will be updated….with more interesting content…in coming days…
Azure IoT Central is a SaaS platform for IoT projects.
If you are looking for a way to manage and monitor your IoT devices outside the Azure Portal or are not able to build your own IoT platform, IoT Central is the place to be. And you can extend this portal with custom Azure resources using the export functionality.
All you need is to have browser access to Azure IoT Central. You can even run it for free for seven days to test it out. Also, the first two devices registered are free too.
Once you have worked with Azure IoT central, you have mastered it using the portal. If you want to scale up eg. the number of devices or users, automation of your tasks becomes necessary.
Recently had a requirement to get all selected option texts from a multi select option set. Getting selected values is straight forward but I wanted to get the Label of selected values. For normal option set we can get it easily by using FormattedValues but that does not work with Multiselect Option set.
For C#:
Then found an handy code by Ravi Kashyap that was posted on community here. I have just restructured the function to make it generic.
Now just call the getSelectedOptionSetText() function and pass Organization Service, entity name and MultiSelect optionset field name.
The function first retrieves all the labels from the Option Set and then filters it with selected option set values.
public string getSelectedOptionSetText(IOrganizationService service, Entity enRecord, string fieldName) { string selectedText = string.Empty; // Get the Formatted Values of MultiSelect OptionSet List multiSelectTextCollection = GetOptionSetTextCollection(service, enRecord.LogicalName, fieldName);
if (enRecord.Contains(fieldName)) { OptionSetValueCollection multiSelectValueCollection…
In the earlier blog post, we have seen how to connect to your Azure IOT Hub using Raspberry PI Online Simulator and send telemetry data…
In this post, we will be using Azure IOT Device Client SDK’s for sending the Telemetry data to IOT Hub…
This approach uses .NET Core SDK libraries using a Console application….
Creating a C# Console Application
Open Visual Studio, go to File -> New -> and select Project.
In Templates, select Visual C#, select Console App (.NET Framework) and give an appropriate name in the ‘Name’ textbox and then click the OK button.
3. Installing Microsoft Azure IOT Device Client SDK…Go to Project -> Manage NuGet Packages.
4. Click Browse tab and search for Microsoft.Azure.Devices.Client. You will see the Microsoft.Azure.Devices.Client device SDK will have listed in the search result and click Install button
5. Now, click the I Accept button to accept the license agreement.
6. It will take a few minutes to install the SDK in our project
7. Get IoT device connect string from Azure IoT Hub…navigate to Azure Portal –> IOT Hub –> IOT Devices –> Select respective device to be connected.
Using Microsoft.Azure.Devices.Client library we can create device client. The device client has CreateFromConnectionString method which requires device connection string as parameter. Create a read only static string s_connectionString01 and assign the connection string that we copy from Azure Portal.
Here you can create a random temperature and humidity values using Random() method.
This post is to understand the Node.js code used to connect to Azure IOT Hub…the complete code can be found This post is just to explain in detail for beginners to understand this quickly.
Now we will understand the code in the integrated console window as highlighted below…
So let’s understand each piece of it…
Firstly we need to understand about controlling the GPIO pins of the Raspberry PI…for high performance C language should be preferred language used but most developers are more comfortable with JS/Node…node.js is used.
So in order to read the pins, we should be using package require(‘wiring-pi’);
Next we will be requiring Azure IOT Device Client SDK’s to create a client for interaction with the Raspberry PI and to send messages
require(‘azure-iot-device’)
Based on the protocol being used, we need to import the respective package..
The following table provides the high-level recommendations for your choice of protocol:
Protocol
When you should choose this protocol
MQTT MQTT over WebSocket
Use on all devices that do not require to connect multiple devices (each with its own per-device credentials) over the same TLS connection.
AMQP AMQP over WebSocket
Use on field and cloud gateways to take advantage of connection multiplexing across devices.
HTTPS
Use for devices that cannot support other protocols.
MQTT and AMQP are binary protocols, which result in more compact payloads than HTTPS, this sample uses MQTT Protocol for communication, hence below package is used
require(‘azure-iot-device-mqtt’).Mqtt;
For bme280-sensor, a Node.js I2C module for the Bosch BME280 Humidity, Barometric Pressure, Temperature Sensor, used below
require(‘bme280-sensor’);
Regarding the connection string, you can follow my previous post on getting this from Azure Portal, however there is also an alternative to use SDK’s
There is a function in azure-iot-device npm (IoT Hub Device SDK for Node.js) to generate device connection string:
import { ConnectionString as DeviceConnectionString } from "azure-iot-device";
const deviceConnectionString = DeviceConnectionString.createWithSharedAccessKey(hostName, device.deviceId, device.authentication.SymmetricKey.primaryKey);
You could also refer to full code here to see how Azure IoT Toolkit generates the device connection string.
The next part is the custom logic on sending messages based on the temperature sensor to Azure IOT Hub and switching on the LED based conditions which is completely based on the needs…
This is my first post in the Azure IOT series….and really excited to share this content.
Have you ever tried a lot to get some hands-on experience connecting devices to Azure IOT Hub. Don’t worry…Microsoft IOT Team had made it so easy so that we can connect to a real device like Raspberry Pi without actually having any physical hardware with you.
This is all possible with Open Sourced Raspberry Pi Online Simulator…with the below link..
Once you open this…you should see the below screen….all you need to enter your IOT Device connection string…
If you check in the above image, you could see that connectionString is highlighted which you need to get from Azure Portal. So lets see how you can get this from Azure portal…
Step 1: Create a free Azure account or if you already have one proceed to next step
Step 2: Create Azure IOT Hub from Azure portal
From the Azure homepage, select the + Create a resource button, and then enter IoT Hub in the Search the Marketplace field
In the results, click Create.
Step 3: Once the deployment is succeeded and your Azure IOT Hub got created, you need to create a device to which you will be connected by navigating as below. Select IOT Devices under Explorers available in the Side pane as highlighted below
Step 4:
Click on New Device as highlighted below
Step 5: Enter Device ID and click on save as higlighted below
Step 6: Now Open your device by click on IOT Devices…and grab the primary connection string..make sure Enable connection to IOT Hub is enabled as below.
Step 7: Now go back to Raspberry PI Simulator and enter this connection string at the place shown in the first image.
Step 8: And finally boom…you will see that the message sent to Azure…and the bulb was switched on.
In the next post, will briefly describe on the Node.js code used and also on the Device SDK’s for Azure IOT so that we can gain more insight.
If you have any further questions on this….please post it here or you can reach out to Community Support on this tool at the below link…