Showing posts with label Model Driven Apps. Show all posts
Showing posts with label Model Driven Apps. Show all posts

Monday, January 29, 2024

How to use Retrieve and Retrieve Multiple using PowerShell

Introduction:


In this Blog we will see how to use Retrieve and Retrieve Multiple using Power Shell with Dataverse or MSCRM


1. Retrieve:

 

Retrieve Used to Retrieve Single Record at a Time

 

CMDLETS:

 

Get-CrmRecord

 

Sample :

 

Get-CrmRecord -conn $conn -EntityLogicalName account -Id be02caab-6c16-e511-80d6-c4346bc43dc0 -Fields name,accountnumber

 

 

account - Entity Logical Name

be02caab-6c16-e511-80d6-c4346bc43dc0 - GUID of record to Retrieve

name,accountnumber - Field from Account Table

 

 

2. Retrieve Multiple :

 

Retrieve Multiple Used to Retrieve Multiple Records at a Time

 

CMDLETS:

 

Get-CrmRecordsByFetch

 

Sample :

 

$accountFetch = @"
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false"> 
<entity name="account">
<attribute name="name" /> 
</entity>
</fetch>
"@

$multipleRecord = (Get-CrmRecordsByFetch -conn $conn -Fetch $accountFetch).CrmRecords

 

 

That's it :)

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

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

Monday, April 17, 2023

How to Change Label Text in Form using JavaScript in Model Driven Apps

Introduction:

In this Blog we will see how to Change Label Text in Form Using JavaScript in Model Driven Apps.


Implementation Steps:

 

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

 

2. Click More --> Select Tables

 

3. Open the Table where you want to change the Form Text

 

In my Scenario I need to Change the Text Based on Boolean Field.

 

4. Boolean Field

  • Name : Change Text
    • Yes --> If yes then Change Text to Selected Yes
    • No --> If No then Change Text to Selected No

5. Now Create a Web Resource then Upload Below Code

 

function onChangeBooleanField(executionContext) {
    var formContext = executionContext.getFormContext();
    if (formContext.getAttribute("crd20_changetext").getValue()) {
        formContext.getControl('name').setLabel('Selected Yes');
    } else {
        formContext.getControl('name').setLabel('Selected No');
    }
}

 

// crd20_changetext --> Boolean Field Logical Name

//name --> Label to be Changed

 

6. I have Written function in OnChange of Boolean Field

 

7. Once Code Written Refresh the Account Form

 

rampprakash_0-1681723093204.png

 

As i said written Code in On Change

 

Now if i change Value to Yes then You will see Selected Yes as Label

 

rampprakash_1-1681723130587.png

 

 

Now if i change to No then You will see Selected No as Label

 

rampprakash_2-1681723649432.png

 

 

That's it :slightly_smiling_face:

 

Using Change label in JavaScript we can change the Label Text.

Friday, February 24, 2023

Switch Statement using Power Automate

Introduction:


In this blog we will see how to use Switch Statement using Power Automate


Implementation Steps:

 

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

 

2. Click Flows

 

3. Click My Flows --> Click New Flows --> Click Build Your Own

 

4. Select PowerApps

 

rampprakash_0-1677241785738.png

 

5. And Select Power Apps Trigger and Click Next --> Select Switch Statement and Click OK

 

6. It will open a Popup 

 

FOR DEMO AM USING A VARIABLE to SWITCH STATEMENT

 

 

7. Once Opened Click + (New Step) and Select Initialize Variable and Select Type as Integer and provide Value as 1

 

rampprakash_1-1677241950661.png

 

8. Now Add another Variable to Set the Value in Switch Statement

 

rampprakash_2-1677241982315.png

 

9. Now in the Switch Statement Select On as the Variable which we declared in Step 7

 

rampprakash_3-1677242032459.png

 

10. Now in the Case input Value as 1 and set the Value

 

rampprakash_4-1677242073453.png

 

11. Now Click + Button for adding another Case and Add a value like below

 

rampprakash_5-1677242149464.png

 

12. If you have any default value Input the Value in Default

 

rampprakash_6-1677242178581.png

 

13. Now Save the Flow and Click Test and Trigger manually Now as we have Value Hardcoded as 1 now the Switch Case will Navigate to Case 1

 

rampprakash_7-1677242324279.png

 

 

That's it :slightly_smiling_face:

Thursday, February 9, 2023

How to Install Smart Buttons for Ribbon Workbench using XrmToolBox

Introduction:


In this blog we will see how to install Smart Buttons for Ribbon Workbench using XRMToolBox


Implementation Steps:

 

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

 

2. Click Solutions

 

3. Select Import Solutions and import Ribbon Work Bench (Download here)

 

rampprakash_0-1675941386216.png

 

4. Once Solution Imported then Click Gear Icon at the Top and Select Advance Settings

rampprakash_1-1675941569755.png

 

5. Select Solutions --> You will find Ribbon Work Bench

rampprakash_2-1675941615754.png

 

6. Click the Ribbon Work Bench it will open PopUp like below

 

rampprakash_3-1675941639663.png

 

7. At the Left side you can see the Smart Button but it does not contain any values

 

Let's see how to show SMART Buttons

 

8. Now Click Below Link

 

https://ribbonworkbench.uservoice.com/knowledgebase/articles/896958

 

9. Once You Opened Link you will find another Link

 

https://github.com/scottdurow/RibbonWorkbench/releases

 

10. Once you clicked on Above Link you will redirect to Github and Download the Highlighted Solution

 

rampprakash_4-1675941975263.png

 

11. Now again go to Solutions (Follow Point 1 and 2)

 

12. And Import Solution downloaded from Point 10

 

13. Select the Solution and Click Import

 

rampprakash_5-1675942059376.png

 

14. Now again go to Legacy Mode and Click on Solutions and Select Ribbon Work Bench Again

 

15. Once page loaded you can find the Smart Buttons.

 

rampprakash_6-1675942238015.png

 

 That's it :slightly_smiling_face:

 

Friday, January 20, 2023

How to get SubGird Record Count with Webresource in Dynamics CRM

Introduction:


In this Blog, we will see how to Get SubGrid Record Count in MSCRM or Model Driven App using WebResource.


Implementation Steps:

 

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

 

2. Create or Open any Existing Solution

 

3. Open the Table/Entity where you want to get count of SubGrid in my case am taking Account Table

 

rampprakash_0-1674210056707.png

 

4. As per the ScreenShot there is 4 Records available so i need to show as a popup with Count as 4

 

5. So First Step i will take the Sub Grid Name

 

6. Open the Form where your SubGrid Exists 

 

rampprakash_1-1674210171186.png

 

 

7. Based on the Above ScreenShot the Name of the SubGrid is Contacts

 

8. Now Lets Start Writing the JavaScript

 

9. Open Your Visual Studio or VS Code and Write the Below Function

 

function getsubgridcount(executionContext) {
    setTimeout(function () {
        var formContext = executionContext.getFormContext();
        if (formContext !== null && formContext != "undefined") {
            var accountgridname = "Contacts";
            var count = formContext.getControl(accountgridname).getGrid().getTotalRecordCount();
            alert(count);
        }
    }, 15000);
}

 

10. Now Create a JavaScript (Web Resource) in CRM 

 

rampprakash_2-1674210958690.png

 

11. Click Save and Publish

 

12. Now Open the Same Account Form and Add the JavaScript Library in the Form

 

rampprakash_3-1674211210777.png

 

13. Now Add Function in the OnLoad Operation

 

rampprakash_4-1674211290953.png

 

14. Once Done Click Save and Publish

 

15. Now Open the Account Table and Open a Record you will see the alert message over there :slightly_smiling_face:

 

rampprakash_5-1674211665753.png

 

 

That's it :slightly_smiling_face:

How to Import Data from Excel to Multiple tables in PowerApps

Introduction:   I have created a view on how to import data from excel to multiple tables in Canvas PowerApps   Implemented Steps: ...