Showing posts sorted by date for query model driven app. Sort by relevance Show all posts
Showing posts sorted by date for query model driven app. Sort by relevance Show all posts

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:

Wednesday, January 4, 2023

How to Create Model Driven Apps With Security Role Restriction

Introduction: 


In this Blog we will see how to Create Model Driven Apps with Security Role Restriction.


Implementation Steps:

 

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

 

2. Click Apps

rampprakash_0-1672810833789.png

 

3. Now Click on New App and Select Model Driven App

 

rampprakash_1-1672810867637.png

 

4. Then Input the Name for the Model Driven App and click Create

 

rampprakash_2-1672810916805.png

 

 

5. Once Done Click Add Page and Select the Page which you want to display, for demo am selecting Dataverse table and click Next

rampprakash_3-1672811085419.png

 

6. Now select Existing table and select the table and Click Add

 

rampprakash_4-1672811132186.png

 

7. Once Done click Save and Publish

 

rampprakash_5-1672811166770.png

 

8. Once the App Gets Created now Click Play it will open a Popup with the App Which we have created.

 

9. Now Click on Settings and Select Advance Settings

 

rampprakash_0-1672811372993.png

 

10. Once Page Opened Select the Setttings and Click Apps

 

rampprakash_1-1672811593129.png

 

 

11. You can see the App which you have created now Select the three dots and select Manage Roles

 

rampprakash_2-1672811724501.png

 

12. Once Selected it will Open the Roles --> select the Roles and Click Save

 

rampprakash_3-1672813533473.png

 

13. Once Save done.

 

The Respective Model Driven App will Load if the Logged in user contains that Specific Security Role which we have selected in Step 12.


That's it :slightly_smiling_face:

Wednesday, May 18, 2022

How to Set Model Driven App theme in PowerApps Canvas

Introduction:


In this Blog we will see how to set Model Driven App theme in PowerApps Canvas


Implementation Steps:

 

Model Driven Apps:

 

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

 

2. Click Gear Icon at the Top --> Select Advance Settings 

 

3. Once the Page Loaded --> Click Customization --> Select Theme --> You will see Default Theme ( You can see only one default theme for an Application)

 

COPY THE NAME OF THEME

 

rampprakash_0-1652872015072.png

 

4. Now go to https://make.powerapps.com

 

5. Click App --> And Provide the Name for the App and select Tablet or Phone Mode based on your needs --> In this i have selected Tablet Mode

 

rampprakash_1-1652872425930.png

 

6. Click DataSource --> Select Theme DataSource

 

rampprakash_2-1652872577998.png

 

7. Once the DataSource Added In the On Start of App Paste the below code

 

Set(getThemeValues,LookUp(Themes_1,'Default Theme'='Default Theme (Themes_1)'.Yes));

 

  1. Get the Value from Lookup in Theme with Default Theme as Yes

 

8. Add Multiple Labels in the Form

 

rampprakash_3-1652872738660.png

 

9. Now Based on the Theme we can load the values(getThemeValues)

 

10. Now Add one by one to the LABEL : FILL and Label Text

 

rampprakash_4-1652872838797.png

 

ColorValue(getThemeValues.'Legacy Accent Color')
ColorValue(getThemeValues.'Navigation Bar Fill Color')

 

11. Based on the Above code we can use the color in different places according to Model Driven App

 

Final Output

 

rampprakash_6-1652873257380.png

 

 

That's it :slightly_smiling_face:

 


Friday, April 1, 2022

Hide Command Bar using JavaScript in Model Driven App

Introduction:


In this Blog, we will see how to hide Navigation Bar in Model Driven App using JavaScript.


Implementation Steps:

 

When ever you tried to create a new Record, you will be redirected to a page like below

 

rampprakash_0-1648728054363.png

 

Red Color Highlighted Called Command Bar

 

If we want to hide that Command Bar follow below steps to achieve the same.

 

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

2. Click Solutions --> Create a new Solution

3. Click New --> Click More --> Select Web Resource and add a new Web Resource

 

rampprakash_1-1648728360258.png

4. Write below code in Web Resource

 

 

function onLoadHideCommandBar(executionContext) {
    var formContext = executionContext.getFormContext();
    formContext.ui.headerSection.setCommandBarVisible(booleanValue);
}

 

 

booleanValue : pass true or false as an option

 

true - visible Command bar

false - hide Command bar

 

Once Code Published:

 

Load or Open a new Record

 

rampprakash_0-1648836606039.png

 

Now you cannot see the Navigation Bar.

 

That's it :slightly_smiling_face:

 

Tuesday, October 19, 2021

Side Panes in Model Driven Apps


Introduction:

 

In this Blog, we will see what are the features and how we can use Side Panes in Model Driven Apps.

Implementation Steps:

 

Consider a scenario, on click of a Button I need to show a HTML page in the Form. Initially we have used Dialog to display the same in the form but Microsoft have introduced a new feature to display a SIDE PAN in the Form

 

Syntax:

 

Xrm.App.sidePanes.createPane(paneOptions)

 

PanOptions:


You can refer to https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/xrm-app/xrm-app-sidepanes/createpane


Sample Code to Open HTML Page:

 

Check Weather the pane is already opened or not. If opened Close the pane

 

 

var currentPane = Xrm.App.sidePanes.getSelectedPane();
if (currentPane !== null && currentPane !== undefined && currentPane.paneId === "PANIDUNIQUENAME") {
var promotionPane = Xrm.App.sidePanes.getPane("PANIDUNIQUENAME");
promotionPane.close();
}

 

 

Below code for Opening the HTML page in Side pan

 

try {       
        Xrm.App.sidePanes.createPane({
            title: "PANID",
            paneId: "PANIDUNIQUENAME",
            canClose: true
        }).then((pane) => {
            pane.navigate({
                pageType: "webresource",
                webresourceName: "/webresources/yourhtmlpage.html"
            });
        });
    }
    catch (e) {
        throw e;
    }

 

 

If you want to pass any parameter from form to HTML in Side Pan

 

 

try {      
var formContext = primaryControl;
var qs = "guidofRecord=" + formContext.data.entity.getId().replace('{', '').replace('}', ''); // guidofRecord = you can pass any dummy variables
        Xrm.App.sidePanes.createPane({
            title: "PANID",
            paneId: "PANIDUNIQUENAME",
            canClose: true
        }).then((pane) => {
            pane.navigate({
                pageType: "webresource",
                webresourceName: "/webresources/yourhtmlpage.html"
                data: encodeURIComponent(qs)
            });
        });
    }
    catch (e) {
        throw e;
    }

 

 

Thats it.


Conclusion:

This is how we want to display HTML image using Side Pan in DataVerse/MSCRM

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...