Thursday, August 31, 2023

How to Use Delete Operations in Microsoft Dataverse or MSCRM

Introduction:


In this Blog we will see how to use Delete operations in Microsoft Dataverse or MSCRM


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 Delete Operation in Dataverse

 

Copy and Paste the below Code for Delete Operations

 

CrmServiceClient service = new CrmServiceClient(connectionString);
service.Delete("account", new Guid("a4cea450-cb0c-ea11-a813-000d3a1b1223"));

 

"account" --> Entity Logical Name

"a4cea450-cb0c-ea11-a813-000d3a1b1223" --> GUID of the Record to Delete

Friday, August 11, 2023

How to Use Update Operations in Microsoft Dataverse or MSCRM

Introduction:


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


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 Update Operation in Dataverse

 

Copy and Paste the below Code for Update Operations

 

Entity updateAccount = new Entity("account");
updateAccount.Id = new Guid("e0385c7b-8b32-ee11-bdf4-002248d5d764");
updateAccount["name"]= "Updated from Console Application";
service.Update(updateAccount);

 

"account" --> Entity Logical Name

"e0385c7b-8b32-ee11-bdf4-002248d5d764" --> GUID of the Record to Update

"name" --> Field Name to Update

"Updated from Console Application" --> Values to be Updated

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:

Monday, July 31, 2023

How to Use Retrieve Operation in Dataverse using Console Application

Introduction:


In this Blog we will see how to use Retrieve Operation in Dataverse using Console Applicaiton


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 Retrieve Operation in Dataverse

 

Copy paste the Below Code

 

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 retrieveAccount = service.Retrieve("account", new Guid("e5c5f9b6-6b2f-ee11-bdf4-002248d5d764"),
                    new Microsoft.Xrm.Sdk.Query.ColumnSet(true));

                string accountName = retrieveAccount.Attributes["name"].ToString();
                EntityReference AccountOwner = (EntityReference)retrieveAccount.Attributes["ownerid"];
            }
        }

 

In the above snippet you will see 

 

"account" --> Logical Name of the Table

"e5c5f9b6-6b2f-ee11-bdf4-002248d5d764" --> Guid of the Record

Microsoft.Xrm.Sdk.Query.ColumnSet(true) --> (true) to retrieve all the Records from the table

retrieveAccount.Attributes["name"].ToString() --> Retrieve Name of the Record from the Account Table

(EntityReference)retrieveAccount.Attributes["ownerid"] --> Retrieve Owner of the Record from the Account Table



Video : https://youtu.be/9td8eyx1hkc

Monday, July 24, 2023

How to Connect Dataverse with Console Application

Introduction:


In this Blog we will see how to Connect Dataverse with Console Application.


Implementation Steps:

 

1. Open Visual Studio

 

2. Search for .Net Framework

 

rampprakash_0-1690195194751.png

 

 

3. Select Next 

 

rampprakash_2-1690195235634.png

 

4. Input your Name and Click Create

 

5. It will Create a Console Application Project

 

6. Once Created Input the Below Code

 

try
                {
                    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
                    CrmServiceClient conn = CrmServiceClient(ConfigurationManager.ConnectionStrings["Xrm"].ConnectionString.Decrypt());
                    conn = new CrmServiceClient("AuthType=Office365;Url=https://URL.crm4.dynamics.com/;Username=USERNAME;Password=PASSWORD;RequireNewInstance=True");

                    if (conn.IsReady)
                    {
// Connection Established
                    }
else{
// Connection Not Established
}

                    return conn;
                }
                catch (Exception ex)
                {
                    throw;
                }

 

7. Once you pasted above code you will get error like below (ITS because of Missing Assembly)

 

rampprakash_3-1690195604096.png

 

 

8. Right Click on the error CRMServiceClient you will get Quick Actions Select and Select Install Package Microsoft.CrmSdk.XrmTooling.CoreAssembly

 

rampprakash_4-1690195717821.png

 

9. Once Done it will automatically install all the Respective Assembly 

 

rampprakash_5-1690195762223.png

 

 

That's it :slightly_smiling_face:

 

Once done you are good to go with the CRM Connection and process.

 

Note:

 

We can use Client ID and Client Secret as well to establish Connection

Wednesday, June 21, 2023

How to Create Record in Dataverse - Excel Import

Introduction: 

In this Blog we will see how to import record in Dataverse using Excel.

Implementation Steps:

 

1. Navigate to https://make.powerapps.com

 

2. Choose the Table where you want to Import the Record, in my case am Choosing Account Table

 

3. Now click Gear Icon at the Top then Select Advance Settings (For Legacy)

        Else Select Table --> Open Account --> Click Export

 

4. In my Case Am Taking Legacy Mode and Select Advance Find then Select Account Table and Click Result

 

rampprakash_0-1687329207531.png

 

5. Once the Page Loaded Select Export Accounts and Select Static WorkSheet

rampprakash_1-1687329251439.png

 

6. Once the Excel Downloaded --> Open the Excel and Remove the Rows which is available and Add a New Record which you want to create in Dataverse Account Table

 

7. Now once the Record added in a Row then Save the Excel as CSV format

 

rampprakash_2-1687329349998.png

 

rampprakash_3-1687329398863.png

 

8. Once Saved Go the Point 2 Again and Select Data Management and Select Imports

 

rampprakash_4-1687329442819.png

 

9. Click Import Data at the Top of the Ribbon

 

10. Now Choose the File (Saved .csv format)

 

rampprakash_5-1687329494947.png

 

 

11. Click Next and Select Next again and Select Default(Automatic Mapping)

 

rampprakash_6-1687329537719.png

 

 

12. Select Account as an Entity and Click Next

 

rampprakash_7-1687329566617.png

 

 

13. Now the Field will get mapped successfully if it is not mapped then Map the correct fields and Click Next

 

14. Select the Owner and Select weather you want to allow duplicates or not and Click finish

 

rampprakash_8-1687329642100.png

 

15. Once done you can able to see the Status of the Record

 

rampprakash_9-1687329681646.png

 

16. Once the Status Reason is Completed you can able to see the Records in your Dataverse Environment 

 

 

That's it :slightly_smiling_face:

Wednesday, May 31, 2023

Host in Canvas PowerApps

Introduction: 


In this Blog we will see how to use Host in Canvas PowerApps


Implementation Steps:

 

In Canvas PowerApps there is an Option Called Host which Contains

  • BrowserUserAgent
  • OSType
  • SessionID
  • TenantID

1. BrowserUserAgent : This Will Show the User's Browser Agent

 

rampprakash_0-1685529895877.png

 

 

2. OSType : Type of OS 

 

rampprakash_1-1685529933795.png

 

3. Session ID: Current Session ID

 

rampprakash_2-1685529960681.png

 

 

4. Tenant ID: Tenant id (Environment ID)

             

rampprakash_3-1685530007019.png

 

 

That's it :slightly_smiling_face:

Day 11 - Customizing Option Sets Dropdown Fields with JavaScript

  In this Blog, we will see how to Customizing Option Sets Dropdown Fields with JavaScript label1 = formContext.getAttribute( "bosch_op...