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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

JavaScript is not being loaded and getting error "there was an error with this fields customized event"

(0) ShareShare
ReportReport
Posted on by 56

I am getting error, that my JS is not loaded:

 ErrorMessage_5F00_Picture1.pngErrorMessage_5F00_Picture2.png

This function is not being loaded on the page, as you can see error message. I am having difficulty to understand, why my JS is not being loaded:

function filterleadContacts() {

    debugger;

    var LeadId = Xrm.Page.getAttribute("seda_lead").getValue();

 

    alert(LeadId);

    //filter LookUp BoothService

    if (IsFieldExistsOnForm("seda_lead")) {

        if (!IsLookUpEmpty("seda_lead")) {

            EnableField("primarycontactid");

            Xrm.Page.getControl("primarycontactid").addPreSearch(function () {

                addLeadCustomFilterLookUp(LeadId);

            }

            );

        }

    }

    else { HideField("primarycontactid");  }

}

 

// Method Description: Filter Function attached to filterBoothServices function

 

function addLeadCustomFilterLookUp(param_LeadId)

{

    debugger;

    try {

        if (param_LeadId != null && param_LeadId != undefined) {

            //alert('Lead ID Value: ' + param_LeadId);

            //alert('Dekh Yaaar: ' + GetOptionSetValue("seda_lead"));

            var Acct = Xrm.Page.getAttribute("seda_casetypec");

                                                var obj = Xrm.Page.getAttribute("seda_lead");

                                                alert("Lead Value Checking: " + obj);

            alert("Uzwa Checking: " + Acct);

            var filter = "<filter type='and'>" +

                "<condition attribute='seda_lead' operator='eq' value='" + param_LeadId + "'/>" +

              "</filter>";

 

            //filter booth services based on the booth selected in participant screen

            Xrm.Page.getControl("primarycontactid").addCustomFilter(filter);

 

Xrm.Page.getControl("primarycontactid").addPreSearch(function () {

 

                      Xrm.Page.getControl("primarycontactid").addCustomFilter(filter);

 

 

 

        }

    }

    catch (e) {

        throw new Error(e.message);

    }

 

}

*This post is locked for comments

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

    Hi,

    You are missing a " } " at the end of the file.

    Best regards

  • Verified answer
    ajyendra Profile Picture
    1,738 on at

    Hi,

    I don't understand the purpose of code. But it seems some syntax error. Copy below code as it is

    function filterleadContacts() {

        debugger;

        var LeadId = Xrm.Page.getAttribute("seda_lead").getValue();

     

        alert(LeadId);

        //filter LookUp BoothService

        if (IsFieldExistsOnForm("seda_lead")) {

            if (!IsLookUpEmpty("seda_lead")) {

                EnableField("primarycontactid");

                Xrm.Page.getControl("primarycontactid").addPreSearch(function () {

                    addLeadCustomFilterLookUp(LeadId);

                }

                );

            }

        }

        else { HideField("primarycontactid");  }

    }

     

    // Method Description: Filter Function attached to filterBoothServices function

     

    function addLeadCustomFilterLookUp(param_LeadId)

    {

        debugger;

        try {

            if (param_LeadId != null && param_LeadId != undefined) {

                //alert('Lead ID Value: ' + param_LeadId);

                //alert('Dekh Yaaar: ' + GetOptionSetValue("seda_lead"));

                var Acct = Xrm.Page.getAttribute("seda_casetypec");

                                                    var obj = Xrm.Page.getAttribute("seda_lead");

                                                    alert("Lead Value Checking: " + obj);

                alert("Uzwa Checking: " + Acct);

                var filter = "<filter type='and'>" +

                    "<condition attribute='seda_lead' operator='eq' value='" + param_LeadId + "'/>" +

                  "</filter>";

     

                //filter booth services based on the booth selected in participant screen

                Xrm.Page.getControl("primarycontactid").addCustomFilter(filter);

     

    Xrm.Page.getControl("primarycontactid").addPreSearch(function () {

     

                          Xrm.Page.getControl("primarycontactid").addCustomFilter(filter);

     });

     

     

            }

        }

        catch (e) {

            throw new Error(e.message);

        }

     

    }

    Thanks

    Ajyendra

    If this answer is helpful. Please Mark as Verified.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
ScottDurow Profile Picture

ScottDurow 2

#2
GJones Profile Picture

GJones 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans