Archive for May 13, 2018

‘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:

  • ‘Portal Comment’ added from Dynamics on a record not showing up in Portal.
  • Below is a ‘Portal Comment’ added for Case record ‘Test’.


  • It was not showing up on Case record on Portal


Reason and Fix:

  • ‘Portal Comment’ will only show up on Portal, when the ‘SEND’ button clicked (i.e, Status = Completed)


  • Now, open the record in Portal and you should see the ‘Portal Comment’
    • Note: Text added in ‘Description’ field of ‘Portal Comment’ will show up on Portal


  • ‘Portal Comment’ can also be added from Portal by using ‘Add Comment’ button and it will show up in ‘ACTIVITIES’ tab of the record.


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”);

// Capture AutoSave event (i.e., SaveMode=70)
if (eventArgs.getSaveMode() == 70) {
Xrm.Utility.alertDialog(“Preventing Auto Save”);

// Capture ‘Save and Close’ event (i.e., SaveMode=2)
if (eventArgs.getSaveMode() == 2) {
Xrm.Utility.alertDialog(“Preventing ‘Save and Close'”);

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.



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


Categories: CRM Tags: ,