{Power 2021} Trigger on save notification only when certain fields change in Model driven App

Business Requirement: Show notification in model driven form on save of table only when particular field/attribute has changed.

clip_image002

Solution: In Dynamics 365 , we can achieve this requirement using following script:

// function to show notitification on save
function onSave(executionContext) {
var formContext = executionContext.getFormContext();
var field = formContext.getAttribute(“fieldname”);
if (field.getValue() == VALUETOMATCH && field.getIsDirty())
{
var message = “Field name has changed”;
var messageString =
{
confirmButtonLabel: “Ok”,
text: message
};

var messageAlertOption =
{
height: 120,
width: 260
};

Xrm.Navigation.openAlertDialog(messageString, messageAlertOption);
}
}

Register this on save and show alerts based on field changed.

Hope it helps and Power 365ing as usual!

Other ways to learn with me:

clip_image001[4]

Any problem in Power Platform or Dynamics 365 – end user, Microsoft partner or an individual?

Problem Area – Technical, Functional, Training, Development or consulting?

Me and my team are here to help, get in touch here: Click here

clip_image002[4]

Advertisement

{Power 2021} Tips for Model driven form design

In today’s blog I will be covering some generic recommendations one should follow while designing Model driven forms.

clip_image001

Ø Review the fields on the form regularly

§ It happens across many CRM deployments over time that certain fields are removed due to business need or are no more relevant to a particular department (Role based forms). Please make sure to remove such unused fields from the form. The lesser the fields, the better the performance as lesser data needs to be transferred over the internet or intranet.

Ø Create different forms for different kinds of departments/ teams/ groups

§ Identify different departments or groupings of individuals in the organization

§ Track the fields that are more relevant to a grouping and consider creating different role based forms.

§ The approach will simplify the usage of form based on relevance to different users and also segregate security requirements.

Ø Avoid unsupported scripting

§ Anything that is not mentioned in Microsoft Docs will be considered an unsupported script. It might be an internal namespace library from Microsoft you are using or DOM manipulation.

§ Try to explain to the customer workarounds to use supported ways of using the form to achieve the requirement.

Ø Mobility considerations

§ If you have needs to use Mobile version of the D365 form, make sure you do proper previews while designing the form to get an idea of how it will appear in D365 Mobile App.

Ø Other Scripting considerations

§ Try to limit onload event handlers, this has a big impact on form load.

§ Use collapsed tabs wherever possible, for example in the case of web resource(html) inside the tab.

§ In case you need to show certain fields based on conditions, keep them initially hidden and then use script to enable them when condition is true.

§ Wherever possible use asynchronous requests instead of synchronous requests.

Ø Usage of sub-grids

§ Not all the sub-grids or related entity data needs to be visible at all times.

§ Try to use and recommend Related tab and Associated grids to the customer wherever related data is needed to be seen which is less frequent to be accessed.

Hope it helps and Power 365ing as usual!

Other ways to learn with me:

clip_image001[4]

Any problem in Power Platform or Dynamics 365 – end user, Microsoft partner or an individual?

Problem Area – Technical, Functional, Training, Development or consulting?

Me and my team are here to help, get in touch here: Click here

clip_image002[4]

{Power 2021} Prevent auto save on specific entities in Dynamics 365 CE

Business Requirement: Client wanted to disable auto save on certain Sales entities such as Leads and Opportunities so that it is sure that user has completed all the information. On all other entities, client requirement was to keep auto save.

Solution: We have to write a small client-side script and register it on save event of Lead and Opportunity record to achieve this requirement.

Here is the script:

function preventAutoSaveOperation(executionContext)

{

var eventArguments = executionContext.getEventArgs();

if (eventArguments.getSaveMode() == 70 || eventArguments.getSaveMode() == 2) {

eventArguments.preventDefault();

}

}

In case you are looking for different types that getSaveMode returns here is the complete list:

Value Save mode Table
1 Save All
2 Save and Close All
5 Deactivate All
6 Reactivate All
7 Send Email
15 Disqualify Lead
16 Qualify Lead
47 Assign User or Team owned tables
58 Save as Completed Activities
59 Save and New All
70 Auto Save All

Hope it helps and Power 365ing as usual!

Other ways to learn with me:

clip_image001[4]

Any problem in Power Platform or Dynamics 365 – end user, Microsoft partner or an individual?

Problem Area – Technical, Functional, Training, Development or consulting?

I am here to help, get in touch here: Click here

clip_image002[4]

{Power 2021} Get current App details in Model Driven App and D365 client-side scripts

In a recent project there was a need to know Model driven App name in client side script.

We can achieve the requirement using following script.

In this example I have alerted App details on Load of a custom entity titled “Visit” under a Model driven App called “Visitor management”.

Here is the output:

clip_image002

Here is the script:

function onLoadApp()

{
var globalContext = Xrm.Utility.getGlobalContext();
globalContext.getCurrentAppProperties().
then(

function successCallback(app)

{
var message = “App Display name: ” + app.displayName + “\nApp name: ” + app.uniqueName + “\nApp Id: ” + app.appId;
var messageString =
{
confirmButtonLabel: “Ok”,
text: message
};

var messageAlertOption =
{
height: 120,
width: 260
};

Xrm.Navigation.openAlertDialog(messageString, messageAlertOption);

},

function errorCallback()

{ console.log(“Error”);

}

);

}

Other details that are accessible in the app object are mentioned below:

· appId

· displayName

· uniqueName

· url

· webResourceId

· webResourceName

· welcomePageId

· welcomePageName

Hope it helps and Power 365ing as usual!

Other ways to learn with me:

clip_image004

Any problem in Power Platform or Dynamics 365 – end user, Microsoft partner or an individual?

Problem Area – Technical, Functional, Training, Development or consulting?

I am here to help, get in touch here: Click here

clip_image006

{Power 2021}Exception handling and notification in Model driven Apps Scripts

Hi All,

In this video supported blog I am going to tell about Exception handling in your scripts in Model driven Apps and how to notify the user in meaningful way.

Here is the code sample used in above video example:

function onLoad(executionContext)
{
try
{
var formContext = executionContext.getFormContext();
formContext.getAttribute(“gendercode1”).setValue(0);
}
catch (exception)
{
var exceptionAlertString =
{
confirmButtonLabel: “Ok”,
text: “On Load error: ” + exception.message
};
var exceptionAlertOption =
{
height: 120,
width: 260
};
Xrm.Navigation.openAlertDialog(exceptionAlertString, exceptionAlertOption);
}
}

Hope it helps and Power 365ing as usual!

Any problem in Power Platform or Dynamics 365 – end user, Microsoft partner or an individual?

Problem Area – Technical, Functional, Training, Development or consulting?

I am here to help, get in touch here: Click here

clip_image007

{Power 2021}How to change the colour of navigation header in Power Apps Portal?

In continuation to Power 2021 blog series, today we will learn how to change the colour of navigation header in Power Apps Portal?

If you want to build a website that can be accessed by any authenticated users, then you may use Power Apps Portal.

Note: You can only create one portal per Power Apps environment. You need to create separate environment for each portal (If you want to create more than one).

So, let’s see the steps of changing colour of navigation header:

1. Select the portal of which you want to change the colour of its navigation header.

2. Click on “Edit”.

3. Now, go to “themes” from left navigation bar as shown below:

clip_image002

4. Select “theme.css” in order to update the code

clip_image004

5. Once you click on theme.css, a code editor window will open. Now, write below code under the code editor:

.navbar-header

{

background-color: “Write colour code or color name here”;

}

6. Find .navbar-static-top.navbar-inverse” and write below code under this function:

.navbar-static-top.navbar-inverse

{

background-color: “Write colour code or color name here”;

}

7. Hit the “Save” button from the top right corner of the code editor window:

clip_image005

8. Click on “Sync configuration

clip_image006

9. Now, Restart the portal once and see the changes made by you.

Hope it helps and Power 365ing as usual!

Any problem in Power Platform or Dynamics 365 – end user, Microsoft partner or an individual?

Problem Area – Technical, Functional, Training, Development or consulting?

I am here to help, get in touch here: Click here

clip_image007

{Power 2021} How to set Priorities

Today am going to share a non-techie video blog entry into my series Power 2021 talking about importance of priorities and how to set them:

 

Hope it helps and Power 365ing as usual!

Any problem in Power Platform or Dynamics 365 – end user, Microsoft partner or an individual?

Problem Area – Technical, Functional, Training, Development or consulting?

I am here to help, get in touch here: Click here

clip_image007

{Power 2021} Enhanced email and related personal settings experience in Dynamics 365

In today’s Power 2021 series blog, Let us explore some of the new email related enhancements in Dynamics 365.

· Ability to compose and keep minimized emails on Activity timeline:

clip_image001

Where is the setting enabled, Look here:

clip_image002

Now let us look at a 2021 Wave 1 preview feature in Sales hub App – Personal settings have moved to a dedicated place:

clip_image003

Now, let us try to Create a new Email template (there are 2 options from blank or existing template). Let us pick from existing template and see the modern editor:

clip_image004

Next thing, let us see the new enhancements for Email signature:

clip_image005

Please note that the 2021 Wave 1 features may change and always refer to Microsoft documentation for this feature.

Hope it helps and Power 365ing as usual!

Any problem in Power Platform or Dynamics 365 – end user, Microsoft partner or an individual?

Problem Area – Technical, Functional, Training, Development or consulting?

I am here to help, get in touch here: Click here

clip_image007

{Power 2021} New Merge experience in Dynamics 365 – UCI only

One of the great needs of any business application is to have the ability to maintain data quality. One of those ways is the ability to Merge records in Dynamics 365 which has been available as a feature for long time.

In the example, I will use today I have created two Dynamisity US records which have 1 child account record each.

Traditional merge experience looks something like this:

clip_image002

To enable the new and improved experience, Navigate to Advanced settings -> Duplicate detection settings and enable highlighted setting and click Ok:

clip_image004

Now let us go back, and Let us click on Merge again on those accounts and see what happens by default (remember to do a hard refresh, if new experience doesn’t show up) :

clip_image006

The great benefit here is getting the ability to by default have fields with Conflicting data.

Another checkbox I have is to Merge records by choosing fields with data.

Then, let us specify All fields from the location where data is filled in our example:

clip_image008

Merging record process started:

clip_image010

Now let us see in the grid that there is one single merged record:

clip_image012

What is interesting, let us see the hierarchy of accounts once:

clip_image014

To explain to you further I had placed Dynamisity India under one parent record “Dynamisity US” and Dynamisity Europe under another parent record “Dynamisity US”. Merge also took care of automatically moving the parent record for Dynamisity Europe record to the merged parent record.

Hope it helps and Power 365ing as usual!

Any problem in Power Platform or Dynamics 365 – end user, Microsoft partner or an individual?

Problem Area – Technical, Functional, Training, Development or consulting?

I am here to help, get in touch here: Click here

clip_image016

{Happy note} Thanks to all the subscribers of PowerOfD365: my YouTube channel

Thank you note for all the subscribers of PowerofD365 YouTube channel, I touched 600 subscribers on my channel today.

clip_image002

I was able to deliver 59 videos on free learning for the community which was viewed for 19,814 minutes equivalent to 330 hours or 115 Hollywood movies. The important playlists are in the below image:

clip_image004

In case, you have not subscribed here is the link to my channel:

https://www.youtube.com/PowerofD365

Hope it helps and Power 365ing as usual!

Any problem in Power Platform or Dynamics 365 – end user, Microsoft partner or an individual?

Problem Area – Technical, Functional, Training, Development or consulting?

I am here to help, get in touch here: Click here

clip_image006