Customer Engagement & Dynamics CRM Forum

Expand all | Collapse all

Issue populating a field on a form- JavaScript

  • 1.  Issue populating a field on a form- JavaScript

    SILVER CONTRIBUTOR
    Posted Jun 30, 2020 03:18 PM
    Hello,

    I recently created an account form based on one that was existing.  On the old form, the Language and Sales Org populate correctly onLoad. On the new form, which has the same JavaScript, will not populate those fields. I am not a developer and do not really know much about JavaScript.

    Just wondering if anyone can tell me why it would work on one form and not another?  I'd be happy to share further detail on the code, but i am wondering if there is something else that needs to be updated on the new form since the code is identical on the forms.

    Thanks!

    ------------------------------
    Jennifer Havir
    CRM Administrator
    Tennant Company
    Minneapolis MN
    ------------------------------
    The first step toward cloud success. - Migrate from CRM to D365 with expert guidance from Microsoft. I'm Ready


  • 2.  RE: Issue populating a field on a form- JavaScript

    Posted Jul 01, 2020 08:46 AM
    Hi Jennifer,

    Without being able to see what you have set up it is difficult to know what specifically is the issue. I would start by checking to make sure that the onLoad function is being called in the event handlers on the form (yes, this is basic but with limited info we have to start somewhere). Are all the fields in the script on the form?

    Additionally, are you viewing the forms both in the same app, specifically Legacy App vs Unified Interface?

    Scott

    ------------------------------
    Scott Florance
    Business Applications Consultant
    KTL Solutions, Inc, Frederick MD
    ------------------------------

    The first step toward cloud success. - Migrate from CRM to D365 with expert guidance from Microsoft. I'm Ready


  • 3.  RE: Issue populating a field on a form- JavaScript

    GOLD CONTRIBUTOR
    Posted Jul 02, 2020 05:59 AM

    Hi Jennifer,

    There's a few things you can check:

    1. Is the code the exact same and does it NOT reference a specific form?
    2. Did you load the web Resource that holds the functions into the Form Library of your new form?
    3. Is the function you're calling defined on the OnLoad of the form and did you check the boxes for "Enabled" and "Pass Execution Context as first parameter" (if applicable)
    4. Does the function you're referencing have any extra parameters? if so, you'll need to define them in the box "Comma separated list of parameters that will be passed to the function"
    5. Are you 100% sure that the Language and Sales Org field are being populated by the Javascript?
    6. Finally, and this sounds stupid, but I have seen it happening before: are the correct fields on the form? If seen it happening that Orgs have 2 language fields with the same label, but different schema names (eg. new_language and org_preferredlanguage)
    All together, I think it would be very helpful if you share some more details on the code and how you reference it on your forms. It makes it easier for the community to help you troubleshooting this.

    Cheers,

    ------------------------------
    Rogier Vriezen
    CRM Consultant
    Amsterdam, Netherlands
    ------------------------------

    The first step toward cloud success. - Migrate from CRM to D365 with expert guidance from Microsoft. I'm Ready


  • 4.  RE: Issue populating a field on a form- JavaScript

    SILVER CONTRIBUTOR
    Posted Jul 06, 2020 08:06 AM
    Hi Rogier,

    Scott Florance was able to help me on this one.  On the new form i had created i excluded a field from the previous form and the code was attempting to read it because it came over when i copied the new form from the existing one. Because the field was not there, it would not load the other fields that were listed below it in the code.  We removed the code for that field and the rest populated correctly.

    Thank you for your response, and I do appreciate you reaching out.​

    ------------------------------
    Jennifer Havir
    CRM Administrator
    Tennant Company
    Minneapolis MN
    ------------------------------

    The first step toward cloud success. - Migrate from CRM to D365 with expert guidance from Microsoft. I'm Ready


  • 5.  RE: Issue populating a field on a form- JavaScript

    GOLD CONTRIBUTOR
    Posted Jul 07, 2020 01:56 AM

    Hi Jennifer,

    I'm glad to hear your problem was solved! Javascript is finicky, so the solution is often in little things like a field or a wrongly called function.

    And this is how we learn, cause now you know how to check another possible cause the next time you find yourself in a Javascript-battle.

    cheers,  



    ------------------------------
    Rogier Vriezen
    CRM Consultant
    Amsterdam, Netherlands
    ------------------------------

    The first step toward cloud success. - Migrate from CRM to D365 with expert guidance from Microsoft. I'm Ready


If you've found this thread useful, dive deeper into User Group community content by role