Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

SCript Error when i open crm opportunity form

(0) ShareShare
ReportReport
Posted on by 5,091

i.JPG

*This post is locked for comments

  • Verified answer
    Arpit Shrivastava Profile Picture
    Arpit Shrivastava 7,518 User Group Leader on at
    RE: SCript Error when i open crm opportunity form

    Hi Sandeep,

    1. Make sure you are putting the correct field schema name.

    For Example: If you are getting option set length

    var length=Xrm.Page.getAttribute("field Name").getOptions().length;

    and the field schema name is incorrect, this error will appear.

    2. Check the null or empty before play with the object. For Example:

    var obj = Xrm.Page.getAttribute("provide fieldSchemaName here");

    if (obj != null) {

    {

    //then get the length

    }

    3. Before using .length property, check whether the variable is null/undefined/or some other falsy value. If Yes then assign length 0 else calculate the length. Eg :

    var reference, // ref is undefined
    refLength;

    if(reference) {
    refLength = reference.length;
    }
    else {
    refLength = 0;
    }

    If my answer helped to resolve your issue, kindly verify it by clicking 'Yes'. It would be helpful to the other community members seeking to resolve a similar issue.


    Cheers
    Arpit
    https://arpitmscrmhunt.blogspot.in

     

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: SCript Error when i open crm opportunity form

    Hi,

    Please check the web resources (JavaScript files) used in opportunity form.

    Find out the js statement uses length.

    Thanks

  • Verified answer
    gdas Profile Picture
    gdas 50,089 on at
    RE: SCript Error when i open crm opportunity form

    Hi ,

    Seems the object getting null  in your web resource and thats why length property is not identifying .  So you need to check null like below. Go to the web resource which causing error check find where you have use length property.

    if(obj != null)

    {

    // obj.length

    }

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,387 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans