Friday, January 21, 2022

Get Year Difference between 2 Days using Microsoft Flow

 Introduction: 

In this blog we will see how to count between 2 dates using Microsoft flow

 Implementation Steps:

 

Consider I want to count how many years of experience an Employee have (for Eg) 3 Year experience

So here in my scenario I want to Calculate Today's Year - Employee Joining Year

 

As Starting get the Current Year in a Variable

 

 

 

utcNow()

 

 

 

 

rampprakash_0-1642784192695.png

 

The Next step get the Current Year from the Current Date- for that use Substring

 

 

substring(variables('Get Current Date'),0,4)

 

 

 

The same way based on your Dataverse or SharePoint List get the Joining Date of Employee

 

rampprakash_0-1642784473728.png

 

As per Above Image, get the State Date and store it in Variable then As said before use subString to get the Year of Joining Date

 

 

substring(variables('Get Anniversery Date'),0,4)

 

 

Now Convert the Variable to int and use sub to get the Count between 2 dates

 

rampprakash_0-1642784664646.png

 

sub(int(variables('Get Current Year')),int(variables('Get Anniversery Year')))

 

That's it :slightly_smiling_face:

Friday, January 7, 2022

Error Handling in Canvas PowerApps with DataVerse Environment using IfError


Introduction:

In this Blog we will see how to Handle error in Canvas PowerApps with DataVerse Environment using IfError


Implementation Steps:

 

Consider a Scenario, we are having 2 tables one is with Account and another with Opportunity

 

How to Implement Restrict in Dataverse Environment. : https://microsoftcrmtechie.blogspot.com/2022/01/restrict-record-deletion-if-child.html

 

While Deleting Account if any Opportunity Contains Data then we need to Restrict in PowerApps.

 

This Restriction will work Perfectly in Dataverse 

rampprakash_0-1641546671931.png

 

In PowerApps Canvas if you tried to delete the system won't throw Error, lets see how to handle that

 

Open Canvas App then Click File then settings 

 

Click Upcoming Features and Toggle On --> Formula-level Error Management

 



 

Now Write below code in Delete Button

 

IfError(Remove([@Accounts], BrowseGallery1.Selected),Notify("Record Contains Child Record"),Notify("Deletion Success"))

 

Thats it :slightly_smiling_face: This will throw error if any error occurs 

 

rampprakash_3-1641547005068.png

 

Restrict record deletion if child Record Available in Dataverse or MSCRM Environment


Introduction

 In this blog we will see how to Restrict user to delete Record if child record available

Implementation Steps:

 

Consider we are having 2 Entities

  • Account  --> Parent
  • Opportunity --> Child 

Opportunity Table Contains Lookup to account Entity.

 

Now do the below steps to Restrict Account Deletion if any Opportunity Available

 

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

2. Click Dataverse

3. Select Tables

4. Open Account(in my scenario Account is Parent)

5. Click Relationship --> Open Account to Opportunity Relationship --> Click Delete Drop Down --> Select RESTRICT

 

rampprakash_0-1641545694772.png


If you tried to delete Record you will get below error



If you tried to delete the Record you will get below error

 

rampprakash_0-1641546629775.png


 

 

That's it :slightly_smiling_face: 

Wednesday, January 5, 2022

Retrieve Quick View Value using JavaScript in Dataverse Environment

 Implementation Steps:

 

What is Mean by Quick View?

 

If we want to Populate data from One Entity to Another Entity based on Lookup then we can easily create Quick View Form to display the same.

 

Navigate to Forms --> Open main form --> Select Quick View Component and select respective entity and its Quick Form 

rampprakash_0-1640945694379.png

 

Javascript

 

Quick View Form Name : QuickViewContact

 

 

 

 

function getQuickViewForm(executionContext)
{
// get form Context
   var formContext = executionContext.getFormContext();
// get Quick View Contact
   var quickViewControl = formContext.ui.quickForms.get("quickviewcontact");
// get First name
   var firstNameControl = quickViewControl.getControl("firstname");
// Show Alert Dialog from FirstName
   Xrm.Utility.alertDialog(firstNameControl.getAttribute().getValue());
}

 

 

 

Timer Control in PowerApps


 Introduction: 

In this Blog we will see how to Create and Use PowerApps Timer Control in Dataverse Environment.

 Implementation Steps:

 

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

 

2. Create a new Solution

 

3. Add an Existing Entity or Add New Entity 

 

4. Create New Field

         --> Timer End date (Date and Time)

         --> Timer Start date ( Date and Time)

         --> Status Field with (In-Progress, Pending, Completed) (Choice)

 

rampprakash_0-1641388281566.png

 

5. Add the Created Fields in the Form

 

rampprakash_1-1641388330415.png

 

6. Now Navigate below Steps

  • Navigate to https://make.powerapps.com
  • Click Gear Icon at the Top  --> Select Advance Settings
  • Select Cuztomization --> Click Customize the system
  • Expand Entities --> Expand the Table where you have created the fields
  • Click Forms --> Open Main Form
  • Click Insert at the Top then Select TIMER

rampprakash_2-1641388545285.png

 

 

7. Enter the Name and Label

rampprakash_3-1641388583367.png

 

  • Failure Time Field --> When Timer Should be Failed
  • Success Condition --> When Timer Need to be Success
  • Failure Condition --> When Timer Need to be Failed
  • Warning Condition --> When Timer Need to be Warning
  • Cancel Condition --> When Timer Need to be Cancelled
  • Pause Condition --> When Timer Need to be Paused

Based on the Attached Imaged I have used my END Date and TIMER STATUS

 

if Status = Pending  (TIMER SHOULD BE : Paused)

 

rampprakash_4-1641388839783.png

 

if Status = In-Progress (TIMER SHOULD BE : Warning)

 

rampprakash_5-1641389392059.png

 

 

 if Status = Completed (TIMER SHOULD BE : Success)

 

rampprakash_6-1641389430655.png

 

 

That's it :slightly_smiling_face:

 

Please find my video for Step by Step Process

 

Friday, December 31, 2021

Retrieve Quick View Value using JavaScript in Dataverse Environment


Introduction:

In this Blog we will see how to get Values from Quick View Form

Implementation Steps:

 

What is Mean by Quick View?

 

If we want to Populate data from One Entity to Another Entity based on Lookup then we can easily create Quick View Form to display the same.

 

Navigate to Forms --> Open main form --> Select Quick View Component and select respective entity and its Quick Form 


rampprakash_0-1640945694379.png

 

Javascript:

 

Quick View Form Name : QuickViewContact

 

 

function getQuickViewForm(executionContext)
{
// get form Context
   var formContext = executionContext.getFormContext();
// get Quick View Contact
   var quickViewControl = formContext.ui.quickForms.get("quickviewcontact");
// get First name
   var firstNameControl = quickViewControl.getControl("firstname");
// Show Alert Dialog from FirstName
   Xrm.Utility.alertDialog(firstNameControl.getAttribute().getValue());
}

 

 

That's it :slightly_smiling_face:


Wednesday, December 22, 2021

How to get Error Message from Try Block using Microsoft Flow


Introduction 

In this blog we will see how to get the Error Message from TRY in Catch block using Microsoft Flow


Implementation Steps:


1. Navigate to https://flow.microsoft.com


2. Create a new Flow


3. If we follow existing Blog then we can use Try Catch block easily but we cannot get the error message from TRY block to Catch Block


Lets see how to Achieve that



in the Catch block just write result('TRYBLOCKNAME')

In my case it is result('Try')


Thats it :)

Now when an error Message occurs in Try block it will automatically catch the Error Message in Catch Block.



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