Monday, August 7, 2023

How to Use Create Operations in Microsoft Dataverse or MSCRM

Introduction:


In this Blog we will see how to use Create Operations in Microsoft Dataverse or MSCRM environment.


Implementation Steps:

 

As I mentioned in my Previous Blog you can able to follow how to use Dataverse Connection with Console Application.

 

In this Blog we will see how to use Create Operation in Dataverse

 

Copy and Paste the below Code for Create Operations

 

 

 

static void Main(string[] args)
        {
            // Connection string to Dynamics 365
            string connectionString = "AuthType=Office365;Url=https://URL.crm8.dynamics.com/;Username=username@environment.onmicrosoft.com;RequireNewInstance=true;Password=PASSWORD;";

            // Create the CrmServiceClient instance using the connection string
            CrmServiceClient service = new CrmServiceClient(connectionString);

            // Check if the connection was successful
            if (!service.IsReady)
            {
                Console.WriteLine("Failed to connect to Dynamics 365.");
                return;
            }
            else
            {
                Entity createAccount = new Entity("account");
                createAccount["name"] = "Demo Account";
                createAccount["OPTION SET LOGICAL NAME"] = new OptionSetValue(10000);
                createAccount["ENTITY REFERENCE LOGICAL NAME"] = new EntityReference("Entity LogicalName", new Guie(GUID OF RECORD));
                service.Create(createAccount);
            }
        }

 

"account" --> Table Name

"name" --> Logical Name of field Name

OptionSetValue --> to set Drop Down Values

EntityReference --> LookUp Reference.

 

That's it :slightly_smiling_face:

No comments:

Post a Comment

How to Run Microsoft Flow for Every one Month

Introduction: In this Blog we will see how to Run Microsoft Flow for Every one Month. Implementation Steps:   1. Navigate to  https://make.p...