Skip to main content

Posts

Dynamic CRM call external API from the plugin

If you want to call external API from the plugin you need to use Newtonsoft.Json . You can use the below code. Note that in IP URL it is not working but it works with domain name URL: static async Task<bool> CallExternalAPI(Guid beziehungId) { //works bool status = false; HttpClient apiClient = new HttpClient(); apiClient.DefaultRequestHeaders.Accept.Clear(); apiClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); string url = @"https://reqres.in/api/users?page=2"; // Workin version test API URL HttpResponseMessage response = await apiClient.GetAsync(url); if (response.IsSuccessStatusCode) { var result = response.Content.ReadAsStringAsync().GetAwaiter().GetResult(); } return status; }

Dynamic 365 CRUD Operation with non relational entity from Plugin

By default in to plugin a entity we can access entity and its relational entity. If we want to access a non relational entity we need to use  XrmServiceContext . using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel; using Microsoft.Xrm.Sdk; using Microsoft.Xrm.Sdk.Query; namespace TotalBudget.Plugins { /// <summary> /// In order to generate Early Bounded Class, dont need to pass any credential for Active directoy authentication /// CrmSvcUtil.exe /url:http://yourdonain/XRMServices/2011/Organization.svc /domain:yourdomain /out:"EarlyBoundedEntities.cs" /namespace:TotalBudget.Plugins /servicecontextname:XrmServiceContext /// </summary> public class TotalBudgetCalculation : IPlugin { // Global variable Guid _AccountId; int _currencyTypeId; int _year; decimal _gesumBudget; List<TotalBudgetCurrency> _TotalBudgetCurrencyList ...

Dynamic CRM 365 Editable grid get and set selected row column value

When you bind the javascript on field change event check the context from UI and define the javascript function name like this: var year; var weekNumber; var selectedRow = null; var attributeColl = null; function dateChange(eContext) { debugger; var nameAttr = eContext.getEventSource(); var attrParent = nameAttr.getParent(); var startDateField = attrParent.attributes.get("new_startdate"); var date = startDateField.getValue(); //Get week number var currentWeekNumber = parseFloat(date.getWeek()); //Get full year const dt = new Date(date); var currentyear = parseFloat(dt.getFullYear()); //set week value var new_weeknumbercstField = attrParent.attributes.get("new_weeknumbercst"); new_weeknumbercstField.setValue(currentWeekNumber); // Set year value var new_yearcstField = attrParent.attributes.get("new_yearcst"); new_yearcstField.setValue(currentyear); } Dat...

Docker Command Windows Server 2016

Download and install all the latest windows update in to your PC: Install docker and run container host machine and container on process sharaing: In powershell Command: --------------------- Install-Module -Name DockerMsftProvider -Repository PSGallery -Force Install-Package -Name docker -ProviderName DockerMsftProvider -verbose get-service *docker* Restart-Computer -Force docker version docker run microsoft/dotnet:nanoserver docker run mcr.microsoft.com/windows/servercore:1607 docker ps docker ps -a docker ps -a --no-trunc docker run -it microsoft/dotnet:nanoserver dotnet exit docker run -it microsoft/dotnet:nanoserver dotnet docker run -it microsoft/dotnet:nanoserver dotnet --version docker run -it microsoft/dotnet:nanoserver dotnet docker run -it microsoft/dotnet:nanoserver powershell get-process exit docker run -it microsoft/dotnet:nanoserver powershell ls exit ls C:\ ipconfig ls hkcu:\ get-psdrive get-localuser get-localuser | select name, si...

Angular Material table show date and time

If we want to show date and time in to Angular Material table, we can use the binding: <ng-container matColumnDef="receiptDate"> <th mat-header-cell *matHeaderCellDef> Receipt Date </th> <td mat-cell *matCellDef="let element"> {{element.receiptDate| date :"dd.MM.yyyy hh:mm:ss a"}} </td> </ng-container>