web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to enable the java script on bulk edit form in CRM 2016

(0) ShareShare
ReportReport
Posted on by

Hi ,

I want to  enable the java script on bulk edit form to disable some fields only when I'm performing the bulk edit.

Is there anyway to do this ?

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at

    Hi,

    The simplest way is to make the fields as read-only in your default forms and make it editable via JavaScript on load.  By doing this you can lock the field on bulk edit

  • Suggested answer
    Community Member Profile Picture
    on at

    Here is how you can do it with JavaScript.

    function bulkEditFormLogic(bulkeditchk) {
        try {
            console.log("running bulkEditFormLogic:" + JSON.stringify(bulkeditchk));
            console.log("Xrm.Page.ui value is null =" + (Xrm.Page.ui == null));
            if (Xrm.Page.ui == null) {
                bulkeditchk.attemptnumber += 1;
                if (bulkeditchk.attemptnumber <= bulkeditchk.maxattempts)
                {
                    setTimeout(bulkEditFormLogic, 1000, bulkeditchk);
                }
            }
            else {
                var ftype = Xrm.Page.ui.getFormType();
                if (ftype == 6) {
                    console.log("is bulk edit form");
                    //data from the parent form this bulk edit is being run from, these would have values if the bulk edit was being done in the associated grid of a form
                    var entid = this.parent.frames[0].Xrm.Page.data.entity.getId();
                    var entname = this.parent.frames[0].Xrm.Page.data.entity.getEntityName();
                    //put your code here
                }
            }
        }
        catch (err) {
            console.log("Error in bulk edit logic=>" + err.message);
        }
    }
    //we have to run the bulk edit logic outside of a subscription since it doesn't observe subscriptions anymore
    bulkEditFormLogic({ "attemptnumber": 0, "maxattempts": 6 });
    



Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans