Blog Archives - Page 46 of 174 - - Page 46

Category Archives: Blog

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 :

Create Accounting period in Business Central.

CREATION OF ACCOUNTING PERIOD. Step1. Globally search “Accounting Period” and click on the related link. Step2. To create a new accounting period, select process and then click Create year. Step3. By default, system will have a starting date as per the last created accounting period. The no. of periods is 12 by default Period length usually is 1M but can be modified to weeks or quarters. Click ok and a new accounting period is created. CLOSE ACCOUNTING PERIOD Step1. Select Process action and then click on Close Year Step2. System pops up a message stating the start and end date and once the period is closed it cannot be undone. Once you click OK, the closed and data locked column is check true. After Closing the accounting period, we need to close the Income Statement. Step1. Globally search “Close Income Statement” and select the related link Step2. The Fiscal year ending date is automatically filled by the system Step3. Select the journal template you need to post. For Journal batch, create a new batch that can be uniquely identify year end. Step4. Fill in all the necessary details. Click OK and Journal lines are created Step4. Navigate to General Journal and select the batch name Check if the balance is correct before posting.  (First preview post the entries to verify the G/L entries) Step5. Post the journal lines. After posting check the retaining earning account. Hope this helps! Thank you.

Share Story :

Here’s how to Install Power Apps for Windows (Preview) and use Model-Driven and Canvas Apps

Hi Everyone,Awaited moment is here, we finally have Power Apps designated application for Windows. Currently its in Preview so use only for testing as of now until its pushed globally. Here’s the steps to download and use Power Apps for Windows Step 1: Go to Microsoft Store and search “Power Apps” Step 2: Install the application. Step 3: In order to run this application, we need to check WebView2 Runtime version on our device. It should be version 99.0 or later. To check this, go to Settings > Apps > Apps & features. Search for WebView and verify that you have version 99.0 or later installed. For those who don’t have this, follow below steps. To install WebView2 Runtime, download the WebView2 Runtime. Download version 99.0 or later. Installing an earlier version may cause Power Apps to crash. Under Evergreen Bootstrapper, select Download. Go over the license terms and privacy statement and then select Accept and Download. When the download is complete, then run the MicroEdgeWebview2Setup.exe. Step 4: Open and sign-in with your ID Step 5: After logging in, you will find list of Model and Canvas Apps that are shared to you or you having access by security roles. The screen will show all Apps from all the environments present in you tenant. You can also see other model-driven apps if you enable Show non-production apps in settings under Model Apps. That’s all about installing Power Apps on Windows. Find the Microsoft Documentation for Installing – Microsoft Docs Find the Usage of Power Apps Windows – Microsoft Docs List of known issues – Microsoft Docs Hope this was informative and helped you.

Share Story :

Serializing and Deserializing Json objects with key value pairs in C#

Posted On March 30, 2022 by Shruti Gupta Posted in Tagged in ,

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:

Share Story :

Quick Tip: Language Translation on Custom PowerApps Page in Model Driven Apps

Hi Everyone, If you are using Custom Pages in your Model Driven App and would like to have multiple languages as per User’s Personal settings? Here’s a quick helpful method for Custom Pages Step 1: Let’s start by creating a Custom Page Go to PowerApps Maker Studio, in your selected environment outside or inside a solution. Add new Custom Page Step 2: Fill your app as per requirement. I’ll just keep it basic. Note: OOTB Tables/Entities will show translated values except custom text/tooltip/custom tables, etc. Below, for my custom Title Label. I have used Language() function to detect the User’s language set in Personal Settings applied on Browser Level. Step 3: Save, Add and Publish the Page on Site Map (Edit in Preview) section. Reload your Model Driven App to see the effect User’s Language set as English User’s Language set as Spanish Select Spanish in Personal Settings That’s how simple it is to set Language in your Custom Page. Note: If you are working with Custom Entities, BPFs you need to add translation for the Language in Data verse manually. Please follow the steps mentioned in this Blog: Enable language translation on Custom solutions in Dynamics CRM. Hope this helps 🙂

Share Story :

Using Live Share in VS Code

Introduction VS Code has recently introduced a new feature using which multiple people can access the same workspace in VS Code and modify files at the same time. This is huge applications in teaching, code reviews as well as prototyping. You can edit modify separate files at the same time in the same folder. Pre-requisites VS Code References Use Microsoft Live Share to collaborate with Visual Studio Code Configuration Install the Live-Share extension in VS Code.  Click on the “Live Share” button at the bottom left.  Sign in using your Github or Microsoft Account.  You can see the session details in the “Live Share” tab along with previously connected.  Click on the “Invite Participants” to get the link what can be used to share the session.  Now, you can collaborate with different Users and modify the same or different files together.  Conclusion Thus we saw how, we can use Live Share for collaborating while developing or reviewing in VS Code. Special thanks to Vaishnavi Joshi for her help in this blog!

Share Story :

Filtering Entity Lookups based on field value

Posted On March 10, 2022 by Vidit Gholam Posted in Tagged in

I have a contact record with a role option set field with options Billing, Decision Maker, Client, Influencer.  The Requirement is to only show billing contacts i.e. contacts with role billing related to the account selected on the Opportunity in the lookup of the contacts on the Opportunities.  Let’s see how I to filtered the contacts lookup to just show billing contacts :   Step 1:  Create a contacts view such that the role is billing(or any field on which you want to filter is set to the value by which you want to filter that record ).  Step 2:  Set the filter criteria of the contacts lookup field on the opportunity as shown below.  In the Additional properties  turn of the view selector and set the default view to the view you created in #1Step 1  In the Field Behavior Tick the “disable most recently used items for this field”.  Now you will only see contacts with role billing in the lookup of the contacts on the opportunity form.  Hope this helps!   Thank you. 

Share Story :

How to create a table using Azure Logic Apps with proper formatting

In this blog, we will see how we can create a table using HTML language using the Azure logic app. If you see carefully, there is an action block present which is “Create HTML table” but it does not give formatting flexibility. so in this blog, I will explain how we can use compose block to create a table with HTML syntax Step 1: To start with the logic app I took the recurrence trigger. you can use any trigger as per your requirement (which is set to run once a day) Step 2: Compose block is an important block as we are writing HTML syntax to format our table. For the demo I used sample data otherwise you can enter dynamic fields as well. in the highlighted section. Step 3: So output of Compose block is sent as the body of the email as shown in the below screenshot. Output: Email Hope this blog helps you. Thank you !!

Share Story :

How to create Dynamic Option-set/List based on value from other fields in Canvas PowerApps

Hi Everyone, Consider a scenario where we want to filter out a dropdown/combo-box choice field based on value in other field or dropdown.Since we cannot use scripts in Canvas App, here’s how we can show specific choice based on multiple values For this example, I’ve considered a bunch of basic items belonging to Fruits, Vegetables and Dairy products. For example purpose I’ll be creating a collection of values to representation. This step will be avoided for choices field within a table/entity.Below is the ‘Master Record’ of collection. Step 1: Create an indexed collection. (referring to MasterList in this example) Step 2: Let’s say we would like to classify the Master List into 3 categories (Fruits, Vegetables and Dairy). In this example, I’ll be using a dropdown list for which the main dropdown field is required to filter data. I’ll be adding a hidden button, containing the following code Based on the above code,Type 1 refers to “Fruits”, Type 2 refers to “Vegetables” and Type 3 refers to “Dairy” Step 3: Added dropdown which will hold classification values. Step 4: The main dropdown choice field which will be filtered based on categories mentioned by above dropdown. That’s it. We have successfully implemented the dynamic choice list as per values dependent on other field. Hope this helps you.

Share Story :

Update records in Dynamics CRM using Azure Logic Apps

In this blog, we will see how we can update the records  CRM with the help of a logic app workflow. Step 1: Add the recurrence trigger in the logic app and set it to run in a one-day interval. you can set any interval. Without a trigger, you cannot create a logic app. Step 2: Add new step after recurrence trigger Step 3: Add the List records action from Dynamics 365 and connect to CRM with your credentials Select Account entity Step 4: For testing purposes, I have created a test account (account number = 1001)in the UAT environment as shown below. Step 5: Initialize the variable with account number is 1001. The account where you want to change/update the data Step 6: Filter the list of accounts where the account number is equal to 1001 as mentioned above step. Step 7: After finding a record from the account list then we will update the record here I updated the account name and city(Note: Account number should unique) Result Hope this blog helps you Thank you!

Share Story :

SEARCH BLOGS:

FOLLOW CLOUDFRONTS BLOG :


Secured By miniOrange