Thursday, April 7, 2022

Disable Auto Save for Individual Forms in Model Driven Apps

Introduction:


In this Blog, we will see how to Disable Auto Save Functionality on Particular Form Using JavaScript.


Implementation Steps:

 

In my Previous Blog I have explained how to enable or disable AUTO Save functionality in Model Driven Apps. In this Blog we will see how to Prevent Auto Save in Particular or Individual forms using JavaScript.

 

Steps to Follow:

 

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

 

2. Navigate to Solution and Open the Solution which you already have else Create a New Solution

 

3. Create or Add Existing Table where you want to Prevent Auto Save functionality.

 

4. Once Table is Added, Add your Existing Web Resource. Else Create a new Web Resource.

 

5. Steps to Follow to Create a Web Resource

 

6. Add below JavaScript into your Web Resource

 

 

 

function preventAutoSave(executionContext) {
    var formContext = executionContext.getFormContext();
    var eventArgs = executionContext.getEventArgs();
    if (eventArgs.getSaveMode() == 70) {
        eventArgs.preventDefault();
    }
} 

 

 

 

7. Please find the Event Modes that will perform on SAVE operation

 

Event ModeValue
 Save1
 Save And Close2
 Save and New59
 Save as Completed58
 AutoSave70

 

8. Now Open the Table where you want to add Web Resource --> Click Forms --> Open the Form

 

9. Once Form Opens Click Form Library and Click Add Library and Search for the Library and Select the Check Box and Click Add

 

rampprakash_0-1649167174499.png

 

10. Once Added --> Click Events at the RIGHT Side --> Select OnSave --> Click ADD EVENT HANDLER --> Input Function name as preventAutoSave --> Make Sure You Select Check Box - Pass Execution Context

 

11. Now Click Ok --> Click Save and Click Publish.

 

That's it :slightly_smiling_face:

Tuesday, April 5, 2022

Create a Web Resource in Model Driven Apps

Introduction:


In this Blog we will see how to Create Web Resource in Model Driven Apps.


Implementation Steps:

 

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

 

2. Click Solutions

 

3. Create a new Solution 

 

rampprakash_0-1649164788241.png

 

4. Click Create to Create a Solution

 

5. Once Solution gets Created --> Open Your Visual studio to Create  a JavaScript file ( Web Resource is not restricted to JS alone), please find the Screenshot below for the list of items we can create in Web Resource

 

rampprakash_2-1649164965185.png

 

 

6. I have taken VS to Create a new JS file

 

rampprakash_3-1649165202131.png

 

7. I have Written Some Sample JS Code

 

rampprakash_4-1649165280701.png

function sampleJavaScript() {
    alert("hello");
}

 

 

8. Once JS is Ready open the Created Solution  --> Click New --> Click More --> Click Web Resource

 

rampprakash_1-1649164869558.png

 

9. Input the Display Name/Name/Type 

 

10. In My Case Type as JavaScript --> Then Click on Browse --> Select the JavaScript which we have created

 

rampprakash_5-1649165438725.png

 

11. Click on Save.

 

That's it :slightly_smiling_face:

 

Then we can add this JavaScript in Any Place of Forms Etc.,.

Monday, April 4, 2022

How to find Difference between two dates in Hours with calculated fields in Model Driven Apps

Introduction:


In this Blog we will see how to find Difference between two dates in Hours with Calculated Fields in Model Driven Apps


Implementation Steps:

 

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

 

2. Click Solutions (if Already Available) else create a new Solution and add New Table or Existing Table

 

3. Create a new Field inside that Table (Start Date)

 

rampprakash_0-1649055496006.png

 

4. Create another field called End Date 

 

rampprakash_1-1649055496009.png

 

5. Save the Table

 

6. Create a Whole Number Field as Calculated

 

rampprakash_2-1649055496013.png

 

7. Click Calculation --> It will save the table and open a Separate Tab.

 

8. Once the Page Opens add following Condition

  •    Start Date Contains Data
  •    End Date Contains Data

9. Add DiffInHours (It is used to find difference between two dates)

 

10. Write below Query in the Action Field

 

DIFFINHOURS(cr2f9_startdate, cr2f9_enddate)

 

rampprakash_0-1649065757537.png

 

 

11. Now add 

  • Start Date
  • End Date
  • Difference in Date 

Fields into the Form.

 

12. Open a new Record and Input Date and Click Save

 

Positive Number : (End Date is Future)

 

rampprakash_1-1649065973474.png

 

 

 

Negative Number : (End Date is Past)

 

rampprakash_2-1649065994935.png

 

 

 

That's it :slightly_smiling_face:

How to Enable or Disable AUTO SAVE in Model Driven Apps/MSCRM/Dataverse

Introduction:


In this Blog we will see how to Enable/Disable Auto Save functionality in MSCRM or Model Driven Apps


Implementation Steps:

 

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

 

2. Click Apps --> Open your Model Driven Apps

 

3. If the Model Driven Apps is not Available then Once Navigated to Point 1 --> Click Gear Icon at the Top --> Click Advance Settings

rampprakash_0-1649060672102.png

 

4. Once Advanced Settings Page Loaded --> Click Settings --> Click Administration

 

rampprakash_1-1649060761952.png

 

5. Then Select System Settings

 

rampprakash_2-1649060788899.png

 

 

6. It Will Open a Popup

 

7. In the General Tab You will see an option called ENABLE AUTO SAVE ON ALL FORMS

 

rampprakash_3-1649060828190.png

 

Select Yes or No based on Our Needs.

 

Yes --> It will Automatically Saves once you changed the value

No --> You need to Forcefully Click on Save Button to Save the Record.

 

That's it :slightly_smiling_face:

How to find Difference between two dates in Days with calculated fields in Model Driven Apps

Introduction:


In this Blog, we will see how to find difference between two date in Days using Calculated fields in Model Driven Apps.


Implementation Steps:

 

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

 

2. Click Solutions (if Already Available) else create a new Solution and add New Table or Existing Table

 

3. Create a new Field inside that Table (Start Date)

 

rampprakash_0-1649055496006.png

 

4. Create another field called End Date 

 

rampprakash_1-1649055496009.png

 

5. Save the Table

 

6. Create a Whole Number Field as Calculated

 

rampprakash_2-1649055496013.png

 

7. Click Calculation --> It will save the table and open a Separate Tab.

 

8. Once the Page Opens add following Condition

  •    Start Date Contains Data
  •    End Date Contains Data

9. Add DiffInDays (It is used to find difference between two dates)

 

10. Write below Query in the Action Field

 

DiffInDays(cr2f9_startdate, cr2f9_enddate)

 

rampprakash_3-1649055496016.png

 

11. Now add 

  • Start Date
  • End Date
  • Difference in Date 

Fields into the Form.

 

12. Open a new Record and Input Date and Click Save

 

Positive Number : (End Date is Future)

 

rampprakash_0-1649055863103.png

 

 

Negative Number : (End Date is Past)

 

rampprakash_0-1649055768894.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:

 

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