Category Archives: C#
Smarter Data Integrations Across Regions with Dynamic Templates
At CloudFronts Technologies, we understand that growing organizations often operate across multiple geographies and business units. Whether you’re working with Dynamics 365 CRM or Finance & Operations (F&O), syncing data between systems can quickly become complex—especially when different legal entities follow different formats, rules, or structures. To solve this, our team developed a powerful yet simple approach: Dynamic Templates for Multi-Entity Integration. The Business Challenge When a global business operates in multiple regions (like India, the US, or Europe), each location may have different formats for project codes, financial categories, customer naming, or compliance requirements. Traditional integrations hardcode these rules—making them expensive to maintain and difficult to scale as your business grows. Our Solution: Dynamic Liquid Templates We built a flexible, reusable template system that automatically adjusts to each legal entity’s specific rules—without the need to rebuild integrations for each one. Here’s how it works: Why This Matters for Your Business Real-World Success Story One of our client’s needs to integrate project data from CRM to F&O across three different regions. Instead of building three separate integrations, we implemented a single solution with dynamic templates. The result? What Makes CloudFronts Different At CloudFronts, we build future-ready integration frameworks. Our approach ensures you don’t just solve today’s problems—but prepare your business for tomorrow’s growth. We specialize in Microsoft Dynamics 365, Azure, and enterprise-grade automation solutions. “Smart integrations are the key to global growth. Let’s build yours.” We hope you found this blog useful, and if you would like to discuss anything, you can reach out to us at transform@cloudfronts.com.
Share Story :
How to Use Webhooks for Real-Time CRM Integrations in Dynamics 365
Are you looking for a reliable way to integrate Dynamics 365 CRM with external systems in real time? Polling APIs or scheduling batch jobs can delay updates and increase complexity. What if you could instantly notify external services when key events happen inside Dynamics 365? This blog will show you how to use webhooks—an event-driven mechanism to trigger real-time updates and data exchange with external services, making your integrations faster and more efficient. A webhook is a user-defined HTTP callback that is triggered by specific events. Instead of your external system repeatedly asking Dynamics 365 for updates, Dynamics 365 pushes updates to your service instantly. Dynamics 365 supports registering webhooks through plugin steps that execute when specific messages (create, update, delete, etc.) occur. This approach provides low latency and ensures that your external systems always have fresh data. This walkthrough covers the end-to-end process of configuring webhooks in Dynamics 365, registering them via plugins, and securely triggering external services. What You Need to Get Started Step 1: Create Your Webhook Endpoint Step 2: Register Your Webhook in Dynamics 365 Step 3: Create a Plugin to Trigger the Webhook public void Execute (IServiceProvider serviceProvider) { var notificationService = (IServiceEndpointNotificationService)serviceProvider.GetService(typeof(IServiceEndpointNotificationService)); Entity entity = (Entity)context.InputParameters[“Target”]; notificationService.Notify(“yourWebhookRegistrationName”, entity.ToEntityReference().Id.ToString()); } Register this plugin step for your message (Create, Update, Delete) on the entity you want to monitor. Step 4: Test Your Webhook Integration Step 5: Security and Best Practices Real-World Use Case A company wants to notify its external billing system immediately when a new invoice is created in Dynamics 365. By registering a webhook triggered by the Invoice creation event, the billing system receives data instantly and processes payment without delays or manual intervention. To conclude, webhooks offer a powerful way to build real-time, event-driven integrations with Dynamics 365, reducing latency and complexity in your integration solutions. We encourage you to start by creating a simple webhook endpoint and registering it with Dynamics 365 using plugins. This can transform how your CRM communicates with external systems. For deeper technical support and advanced integration patterns, explore CloudFront’s resources or get in touch with our experts to accelerate your Dynamics 365 integration project. We hope you found this blog useful, and if you would like to discuss anything, you can reach out to us at transform@cloudfonts.com.
Share Story :
Comparing Asynchronous Patterns in C# and JavaScript
Asynchronous programming is essential for building responsive applications, especially when dealing with time-consuming operations like API calls, file I/O, or database queries. Both C# and JavaScript provide powerful tools to handle asynchronous code: Promises in JavaScript and Tasks in C#. However, managing these manually can lead to complex, nested code. Enter async/await—a syntactic sugar that makes asynchronous code look and behave like synchronous code, improving readability and maintainability. Async/Await in JavaScript JavaScript relies heavily on Promises for asynchronous operations. While Promises are powerful, chaining them can lead to callback hell. Async/await simplifies this by allowing us to write asynchronous code in a linear fashion. Scenario: Fetching User Data from an API Instead of chaining .then() calls, we can use async/await to make API calls cleaner. Without Async/Await (Promise Chaining) With Async/Await (Cleaner Approach) Benefits:✅ Easier to read – No nested .then() chains.✅ Better error handling – Structured try/catch blocks. Scenario: Sequential vs. Parallel Execution Sometimes we need to run tasks one after another, while other times we want them to run in parallel for efficiency. Sequential Execution (One After Another) Output: Parallel Execution (Faster Completion) Output: Async/Await in C# C# uses Tasks for asynchronous operations. Before async/await, developers relied on callbacks or .ContinueWith(), leading to complex code. Scenario: Downloading Files Asynchronously Instead of blocking the UI thread, we can use async/await to keep the app responsive. Without Async/Await (Blocking UI) With Async/Await (Non-Blocking UI) Benefits:✅ UI remains responsive – No freezing during downloads.✅ Clean error handling – try/catch works naturally. Scenario: Running Multiple Database Queries If we need to fetch data from multiple sources, async/await makes it easy to manage. Sequential Database Queries Parallel Database Queries (Faster Performance) Key Takeaways ✔ Use async/await to avoid callback hell in JavaScript and blocking calls in C#.✔ Sequential execution (await one by one) vs. parallel execution (Promise.all / Task.WhenAll).✔ Error handling is simpler with try/catch instead of .catch() or .ContinueWith().✔ Improves performance by keeping UIs responsive while waiting for I/O operations. By adopting async/await, you can write cleaner, more maintainable asynchronous code in both JavaScript and C#. We hope you found this blog useful, and if you would like to discuss anything, you can reach out to us at transform@cloudfonts.com
Share Story :
Inheritance in C#
In C#, inheritance is a way to create a new class that is a modified version of an existing class. The new class is called the derived class, and the existing class is the base class. The derived class inherits the base class members, which means it has access to all of the base class’s fields and methods. This is useful because it allows you to reuse code and avoid writing the same code over again in the derived class. To create a derived class in C#, you use the: operator, followed by the name of the base class. For example: The derived class can then use the base class members as if they were it’s own. It can also override the base class’s methods or hide them with the new keyword. In the example above, the derived class is overriding the Some Method method from the base class, which means that it is providing a new implementation for that method. The new keyword is used to hide the Some Other Method method from the base class, which means that the derived class provides its own version of the method that is separate from the one in the base class. In addition to inheriting from a single base class, a class in C# can also implement one or more interfaces. An interface is a set of related methods that a class can implement. A class that implements an interface must provide an implementation for each of the methods in the interface. In the example above, the derived class is both derived from the Base Class and implements the Isom Interface. This means that it has access to all of the members of the Base Class as well as the method defined in the Isom Interface. In C#, inheritance is a powerful tool that allows you to create new classes based on existing ones. It helps you reuse code and avoid having to write the same code over again, saving time and making your code easier to maintain.
Share Story :
Secure your Environment Variable inside Azure Function using Key Vault
In the previous blog, we learn about how to use the Environment variable in Azure Function. Environment variables are most important and confidential as they might contain the system credentials or configure that you don’t want any to access directly. The most unsecure way to store them is directly inside the Configuration of Azure function so in this blog we will see how to store the Environment variable inside the Key Vault and use the Key Vault reference in Configuration. You can create an Azure function and use Environment Variable to do so do refer to my previous blog: Step 1: Create a Key Vault Login to Azure Portal and click on + Create a resource called “Key Vault”. Click on Create You can create a new resource group or select the existing group based on your preference. (You can create all resources related to a single project in one resource group so that it will easier to manage resources project wise) You need to set up the Access policy during the creation or after creating the Key Vault. We will set up an access policy for Azure Function later in the blog. Step 2: Set an Access policy for Azure Function. Open the Azure Function in which you want to use the reference of Azure Key Vault. Navigate to Identity Tab and toggle System assigned status to “ON”. Copy the Object (Principle) ID as we are going to use it during adding access policy. Open Azure Key Vault and Navigate to the Access Policies section. Click on + Add Access Policy We will only Add Get Permission in the Secret permissions section. You need to only add the permission that you want to allow your Azure Function can perform. Select the Principle User. Copy the Copied “Object ID” into search it will be easier to find it. Click on Add. Once you will add a resource in the access policy, it will allow your resource (Azure Function) to perform a Get operation on all the secrets from Key Vault. Do not forget to Save after you add the policy. Step 3: Add Secret and Configure it inside Azure Function Navigate to the Secrets section and Click on + Generate/Import Enter the Name and Value(Credentials/Configuration) Open the current version and Copy the secret URL as it will be required while configuring the Reference. Navigate to the Configuration section of Azure Function. Change the Configuration and add the KeyVault Reference as below: @Microsoft.KeyVault(SecretUri=<Copied SecretURL>) Do not forget to Save after changing the configuration Step 4: Testing using Postman We will require the API testing tool, here I am using Postman and the following is the link to download “Postman”. https://www.postman.com/downloads/ Copy the Function URL and send a post request. As result, you will notice the username is coming from KeyVault as we have to change the configuration. Conclusion: This is how you can secure your Environment Variable using Azure KeyVault. You can set up multiple KeyVault for different deployment and access policies depending on the requirement. When you are storing the Credentials and Configuration in KeyVault, you just need to set up the Access policy. All configuration is managed by the Azure Admin and if origination has a policy that they don’t want to share the credentials they can follow this process and only share the KeyVault URL with the developer so that they only need to configure it.
Share Story :
How to call logic app in Azure function app
In this blog, we will see how we can trigger the logic app using the azure function app. Let’s start with creating a logic app (HTTP triggered) that sends an email when the logic app URL is hit in the function app. Step 1: Create a logic app resource and start by adding an HTTP GET request trigger. Url will auto-generate after saving the logic app. Step 2: Add send email block after that to receive an email Step 3: now create a function app in visual studio by creating a new project. Step 4: Add project name and now select type of function app, select the create option Step 5: Add the below code to the auto-generated code template in the visual studio Step 6: Run the function locally. then you will get URL in the command prompt copy that and paste it into your browser. Step 7: After entering the URL you should receive an email as mentioned in the logic app. In this way, the logic app triggered successfully using the function app Hope this blog helps you. Thank you!!
Share Story :
Use of Environment Variable inside Azure Function in C#
In this blog, we will learn how to configure and use Environment Variable in Azure Function. Concept of using Environment variable during your development which needs to deploy on multiple servers and connect to multiple systems. Whenever you use Environment variables to store the global constant or system credentials it reduces the time which was required to modify the code base for multiple deployments. Let’s get started with Creating the Azure Function and using the Environment variable. Step 1: Create an Azure Function inside the Visual Studio: I have created the HTTP Trigger Azure function inside Visual Studio and the authorization level is Anonymous Once you create an Azure Function project you will notice there are many files created with the project. We have a “local.setting.json” file that we are going to use and it holds the environment variable while the development and testing phase of your Azure function. Step 2: Declare credentials/global variable inside “local.setting.json” Information on local.setting.json – This file represents your local application setting for your Azure Function and it stays with your local build only. While you publish your azure function to Azure Portal or commit your code to your Repo this file is never pushed to the server as they are excluded/prevent from committing or publishing. Step 3: Access variable inside the code You can access the environment variable using the Environment class(required System lib). Based on your preference you can either access Environment variable the directly inside the code or you can create a CONSTANT class as mentioned below screenshot. Here, I am passing this environment variable inside a response so that we can test it. Step 4: Testing using Postman We will require the API testing tool, here I am using Postman and the following is the link to download “Postman”. https://www.postman.com/downloads/ To test the application, click on the Start button on top of the Navbar as mentioned below in the screenshot [Button will have Project Name]. It will take a few minutes to Load the Azure Emulator Following is the screen you will be able to see and copy the URL highlighted in the red below and paste that URL into Postman. Result: Now, you need to configure the Environment while deploying the Azure function on Azure Portal, and below are steps for the same: Step 1: Deploy an Azure Function on Azure Portal. You can directly create it on Portal or you can create it from Visual Studio. Here I am going to create and deploy it from Visual Studio: Right Click on the project and select Publish: Select Azure and Click on Next: Click on the + icon to create a new function, You can use the existing resource group or create a new resource group as per your preference: After deployment is completed you can see the deployed Azure function on Azure Portal: Now, if you try to use the Azure Function URL and post the request then you will notice that all the environmental credentials part is missing as we have not configured the environment variable on the Azure portal inside Azure Function App: Step 2: Configure the App Environment variable on Azure Portal for online deployment. Navigate to the Configuration section of your deployed Azure Function Add the Application setting in your Configuration and the Name should same as you have declared in your local.setting.json file. Make sure your click on Save to update the configuration on Portal. After configuration if you test your deployed Azure function using postman you will get your expected result: This is how you can configure and use the Environment variable inside your Azure Function. It will make your life easier while deploying Azure on Development, UAT, or Production Environment. You can store the Source and Destination system credentials, SQL Access credentials, or Custom Global Variable based on your business requirement of integration.
Share Story :
Serializing and Deserializing Json objects with key value pairs in C#
If we have a json data whose objects have one or more key value pairs also known as properties and we need to separate them into individual objects then Serializing and Deserializing method can be used in C#. Sample Json data : { “FirstName”:”Aditya”, “MiddleName”:”Ashok”, “LastName”:”Somwanshi”, “Phone”:[“9004802526″,”34304235”], “Address”:{“Primary”:”Panvel”, “Secondary”:”Cloudfronts”} } Desired Output: { “FullName”: “Aditya Ashok Somwanshi”, “Primary Phone”: “9004802526”, “Secondary Phone”: “34304235”, “Primary Address”: “Panvel”, “Secondary Address”: “Cloudfronts” } First open Visual Studio and create new project in Console application template. Give your Project a name and click next, you will be directed to a new page where you can start with your code. Now we need to install some packages into our project to use it in our code. So at top in the tools section select NuGet Package Manager and in that select Manage Nuget Packages for Solution Now search for Newtonsoft.Json and install the package The purpose for installing this package is to access serialize and deserialize functions in our code. To add a class to main program you need to right click on your project and then select and choose add new item Select class and name the class and add. Now to write the code we need to use Convert JSON to C# Classes Online – Json2CSharp Toolkit for formatting the json to C# and knowing the classes to be used. using System.Collections.Generic; using Newtonsoft.Json; namespace Human { public class Address { public string Primary { get; set; } public string Secondary { get; set; } } public class Person { public string FirstName { get; set; } public string MiddleName { get; set; } public string LastName { get; set; } public List<string> Phone { get; set; } public Address Address { get; set; } } public class Root { public string FullName { get; set; } [JsonProperty(“Primary Phone”)] public string PrimaryPhone { get; set; } [JsonProperty(“Secondary Phone”)] public string SecondaryPhone { get; set; } [JsonProperty(“Primary Address”)] public string PrimaryAddress { get; set; } [JsonProperty(“Secondary Address”)] public string SecondaryAddress { get; set; } } } Now the main program using Newtonsoft.Json; using System; namespace Human { public class Program { public static void Main(string[] args) { string json = @”{ “”FirstName””:””Aditya””, “”MiddleName””:””Ashok””, “”LastName””:””Somwanshi””, “”Phone””:[“”9004802526″”,””34304235″”], “”Address””:{“”Primary””:””Panvel””, “”Secondary””:””Cloudfronts””} }”;//Defining Json Person human = JsonConvert.DeserializeObject<Person>(json);//Deserializing Json Root rt = new Root(); rt.FullName = human.FirstName + ” ” + human.MiddleName + ” ” + human.LastName; //Concatenating Names rt.PrimaryPhone = human.Phone[0]; rt.SecondaryPhone = human.Phone[1]; rt.PrimaryAddress = human.Address.Primary; rt.SecondaryAddress = human.Address.Secondary; string output = JsonConvert.SerializeObject(rt, Formatting.Indented);//Serializing Json Console.WriteLine(output); } } } OUTPUT: