0

I am working on 2016 on-premise MSCRM, I need to check each record in bulk edit and alert the user if something is wrong, I tried to alert it from my update plugin but only general msg appeared, now I'm trying to get all records selected in bulk edit, I googled and found this code :

var formType = Xrm.Page.ui.getFormType();
if (formType == 6)
{
 //Read ids from dialog arguments
 var records = window.dialogArguments; 
 }
} 

To use the bulk edit formtype I need to add to event onload or onchange on customizations.xml the attribute : BehaviorInBulkEditForm=“Enabled“ (unfortunately not so safe to edit this file) .

My questions: which selected rows I'll get in onload and onchange event? ,I'm not sure where to use it in that case and if I'll get all the data I need. Is there a better way/easy to get the data I need or to get the formtype - bulk edit. Soon I'll be using MSCRM 365 is there any easier solution to this case in the 9.0 version ?

Damkulul
  • 1,406
  • 2
  • 25
  • 59
  • do you want to notify user when they use bulk edit and some records or something either went wrong or success? – AnkUser Aug 10 '22 at 09:34

1 Answers1

0

You can use method window.getDialogArguments(); to get ids.

Here is my example:

I added an onLoad event for my form and enabled the BehaviorInBulkEditForm.

function onLoad(formContext) {
    var ids = window.getDialogArguments();
    console.log(ids);
}

The ids is an array, every element is a selected record id.

['{335A56B7-C717-ED11-B83F-00224856D931}', '{CBBDEBFB-C717-ED11-B83F-00224856D931}', '{3607EFC7-C717-ED11-B83F-00224856D931}', '{325A56B7-C717-ED11-B83F-00224856D931}']
ray gan
  • 98
  • 10