Posts

Showing posts from 2023

How to Create a Business Process Flow and Get active stage of record and Update the Stage using C# in D365:

 Create a Business Process Flow                 Ex:  apy_ businessprocessflow           On Create of Contact record Create a business process flow and Get active stage and Set the Stage     Register Plugin on Create of Contact Entity                    using Microsoft.Xrm.Sdk;           using System;  namespace APY.Plugins.Sales {     public class ManageContact : IPlugin     {         public void Execute(IServiceProvider serviceProvider)         {             ITracingService tracer = (ITracingService)serviceProvider.GetService(typeof(ITracingService));             IPluginExecutionContext c...

CURD (Create, Update, Retrieve and Delete) Operation in D365 using Power Shell Script

Connect D365 using below details: Install-Module Microsoft.Xrm.Data.PowerShell -Scope CurrentUser Set-ExecutionPolicy –ExecutionPolicy RemoteSigned –Scope CurrentUser [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 $Username ="APY***@Trailcrm.com" $Password ="apy****" $pwd = ConvertTo-SecureString $Password -AsPlainText -Force  $credentials = New-Object System.Management.Automation.PSCredential($Username, $pwd) $conn = Connect-CrmOnline -Credential $credentials -ServerUrl "https://apytrailcrm****.crm.dynamics.com/" -ForceOAuth Create a record using powershell Syntax:     New-CrmRecord [-conn <CrmServiceClient>] [-EntityLogicalName] <String> [-Fields] <Hashtable> [<CommonParameters>] Ex:      $parentId = New-CrmRecord account @{"name"="parent account name"}     $parentReference = New-CrmEntityReference -EntityLogicalName account -Id $parentId     New-CrmRecord -conn ...

How to Create a Business Process Flow (BPF) on existing Contact and update the stage using conditions in D365 using Power Shell Script

 function UpdateProcessStage{ param( [int]$desiredStagePosition, $processInstance, $retrieveActivePathResponse ) $newStageId = $retrieveActivePathResponse.ProcessStages.Entities[$desiredStagePosition].Attributes["processstageid"] $entity = [Microsoft.Xrm.Sdk.Entity]::new("APY_"+$processInstance["name"].ToLower(), $processInstance.Id) $entity.Attributes.Add("activestageid", (New-CrmEntityReference -Id $newStageId -EntityLogicalName "processstage")) $CRMConnection.Update($entity) } function SetBPFToFinish{ param( $processInstance ) Set-CrmRecordState -conn $CRMConnection -EntityLogicalName APY_Purushflow -Id $processInstance.Id -StateCode 1 -StatusCode 2 } $conn = Get-CrmConnection -InteractiveMode $pagingCookie="" $page=1 $count=5000 do{     $varFetch = Get-CrmRecordsByFetch -conn $CRMConnection -Fetch @"    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="...

How to get more records using FetchXml with paging cookies using Power Shell Script

Connect D365 using below details:  $Username="APY***@Trailcrm.com" $Password="apy****" $pwd = ConvertTo-SecureString $Password -AsPlainText -Force  $credentials = New-Object System.Management.Automation.PSCredential($Username, $pwd) $CRMConnection = Connect-CrmOnline -Credential $credentials -ServerUrl "https://apytrailcrm****.crm.dynamics.com/" -ForceOAuth Declare variables: $pagingCookie="" $page=1 $count=5000 Using do while loop with FetchXml with below code will get more records do{     $varFetch = Get-CrmRecordsByFetch -conn $CRMConnection -Fetch @"    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">     <entity name="contact">     <attribute name="fullname" />     <attribute name="contactid" />     <order descending="false" attribute="fullname" />     <filter type="and...

How to connect d365 current using Powershell script.

 Install the "Microsoft.Xrm.Data.PowerShell" module: Open PowerShell and import the module with the following command if it's not already imported: Install-Module Microsoft.Xrm.Data.PowerShell -Scope CurrentUser There is a small issue with the command you provided. The correct parameter name for setting the execution policy is "ExecutionPolicy," not "–ExecutionPolicy."  Here's the correct version of the command: Set-ExecutionPolicy –ExecutionPolicy RemoteSigned –Scope CurrentUser The command you provided is used to set the security protocol used by .NET's ServicePointManager. Specifically, it sets the security protocol to TLS 1.2,  which is a more secure version of the TLS (Transport Layer Security) protocol used for secure communications over a computer network. [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 Define your CRM connection parameters: You'll need to gather some information to conne...

Get PartyList lookup field in Email/Activities entity update partyid record

Get the partylist lookup value and check the lookup value is contact and update the contact   Entity fromActivityParty = targetEntity.GetAttributeValue<EntityCollection>("from").Entities                 .Where(x => x.GetAttributeValue<EntityReference>("partyid")?.LogicalName == "contact")                 .FirstOrDefault();          if (fromActivityParty == null) return;          EntityReference contactReference = fromActivityParty.GetAttributeValue<EntityReference>("partyid"); Entity contact = new Entity("contact", contactReference.Id); contact["fullname"]= "ApyCRM"; service.Update(contact);

How can we enable and disable Multifactor Authentication in d365

Image
  Create Trial Instance and Login to Trail Open : https://admin.microsoft.com/ Once we opened above URL we can see below screen. Once you click on Multi-factor authentication we can see below screen. If it is enabled you can select user and Disable it. If it is disabled you can select user and Enable it

How to disable/stop Multifactor Authentication on Dynamic 365 CRM

Image
  è   Login into D365 CRM è After login trail CRM in same browser open below. è URL: https://portal.azure.com (Azure Portal) è After opened azure portal in browser è Select Azure Active Directory check in below screen. è Click on properties è Select Manage security defaults. è Enable security defaults property to No. è Select Other and click on Save button Thanks for reading this blog