Archive
D365 Login Issue – Organization Id Not Determined
I was getting below error screen while trying to login to Dynamics instance
Reason:
- You would have already logged in with different Office 365 credentials in your machine.
Fix:
- Try login in using browser’s In-Private or incognito mode.
- Try login by clearing the browser cookies.
- If above options do not work, you might want to use Microsoft Support and Recovery Assistant for Office 365 tool from Microsoft.
- Refer my previous article on the usage part.
🙂
SQL Server Installation – VS Shell installation has failed with exit code 1638
I was getting below error during the SQL server 2017 installation.
VS Shell installation has failed with exit code 1638
Reason:
- Exit code 1638 denotes “Another version of this program is already installed”.
- In my case, I already had Visual Studio 2017 installed on my machine and there was conflict due to “Microsoft Visual C++ 2017 Redistributable” components which got installed with Visual Studio 2017.
Fix:
This issue was annoying and had to spend couple hours to find the actual reason and fix. Below fix worked in my case.
- Uninstall Visual Studio 2017
- Go to Control Panel and uninstall below ‘Microsoft Visual C++ 2017 Redistributable‘ components
- Restart the machine
- Try installing SQL Server
- Proceed with Visual Studio 2017 installation
🙂
D 365 – Prevent Record’s Deactivate/Activate from Form – JScript
Lets see how we can apply our validation logic and prevent Deactivate/Activate of a record from Form.
Its a 3 step process:
- Register script on form’s ‘OnSave’ event
- Capture the ‘Deactivate/Activate’ event (i.e., by reading ‘SaveMode’ from Context)
- Prevent Save operation
Below is the snippet to validate and prevent the Save by reading the type of operation (i.e., Deactivate, Activate, Auto Save, Save and Close, Save and New etc…).
Script :
function onSave(econtext) {
var eventArgs = econtext.getEventArgs();// Capture Deactivation(i.e., SaveMode=5) or Activation(i.e., SaveMode=6)
if (eventArgs.getSaveMode() == 5 || eventArgs.getSaveMode() == 6) {
// Your business logic goes here
Xrm.Utility.alertDialog(“Preventing Deactivate or Activate”);
eventArgs.preventDefault();
}// Capture AutoSave event (i.e., SaveMode=70)
if (eventArgs.getSaveMode() == 70) {
Xrm.Utility.alertDialog(“Preventing Auto Save”);
eventArgs.preventDefault();
}// Capture ‘Save and Close’ event (i.e., SaveMode=2)
if (eventArgs.getSaveMode() == 2) {
Xrm.Utility.alertDialog(“Preventing ‘Save and Close'”);
eventArgs.preventDefault();
}
}
How to use the script:
- Register above script on form’s ‘onsave’ event.
- Make sure you selected ‘Pass execution context as first parameter’ checkbox.
- Save and Publish
- Open the record and try to ‘Deactivate’ and you should get below popup.
Note:
- Script triggers only when you Deactivate\Activate only from Form.
- It does not work from Grids or ‘Advanced find’
Refer article for the complete list of ‘SaveMode’ values.
🙂
DataTable – Destory() method not removing all the rows
In one of my Dynamics portal’s requirements, I had to use Data Tables table control to bind the search results.
I used below snippet to bind the results.
var table = $(‘#customGrid‘).DataTable({
data: rows,
destroy: true,
columns: columns,
oLanguage: {
sLengthMenu: ‘Show _MENU_ items’,
sInfo: ” <b>Showing _START_ – _END_ of _TOTAL_ items</b>”,
sInfoEmpty: ‘ <b>Showing 0 – 0 of 0 items</b>’,
sEmptyTable: “No data to display”
},
‘columnDefs’: [
]
});
In the above snippet
- #customGrid – Is ID of a HTML <Table> object which we use for DataTable.
- <table id=”customGrid” class=”display”></table>
- rows – JSon collection
Problem statement:
I am using ‘DataTable’ in one of my custom HTML Search pages
- I was binding the Search results to the DataTable up on Search button click and have to clear the previous results when no match results found.
- I was calling destroy() function to clear off the rows from previous Search.
if ($.fn.DataTable.isDataTable(“#customGrid”)) {
$(“#customGrid”).DataTable().destroy();
}
- However, destroy() its not removing all the rows.
Reason and Fix:
- destroy() remove all defined events and properties of DataTable object.
- Its not clearing the <table> object rows (This may have fixed or changed in latest versions)
- So, to clear the rows, you must call empty() function of <table> object.
- Below is the final code
if ($.fn.DataTable.isDataTable(“#customGrid”)) {
// Destroy ‘DataTable’ object
$(“#customGrid”).DataTable().destroy();
// Remove the <table> rows
$(“#customGrid”).empty();
}
🙂
‘Portal Comment’ not showing up – Dynamics Portals
‘Portal Comment’ is an OOB activity which comes with Portal solution and enables peer-to-peer interactions between Portal Users and Dynamics Users.
To add ‘Portal Comment’ for a record, go to ‘ACTIVITIES’ tab on the form and select ‘Portal Comment’.
Problem Statement:
Reason and Fix:
🙂