Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Event Handlers in Dynamics CRM 365

Posted on by 676

I have noticed that on filling the customer filed on the case form, customer details get auto populated. I am new to CRM and I assume there is some event running behind which auto populates the quickview form( Cutomer details) on field change event. I have added few more subgrids using quickview form which I wish to auto populate on the change of same field. How can I achieve this? Do I have to write any JavaScript function? Any suggestions are most welcomed.

*This post is locked for comments

  • Mohd Tahir Profile Picture
    Mohd Tahir 676 on at
    RE: Event Handlers in Dynamics CRM 365

    Hi Aiden,

    Say I am on case form:

    Using business rules I have noticed that there's an action "Set a field value". How can we set field values based on certain conditions dynamically?

    For example, if invoice search contains data --> Set customer name accordingly (related to that invoice, if such invoice exists so as customer and invoice have 1 to many relationship).

    You have mentioned in another post that it isn't documented much but we can use related entities using dot notation. But in this case can't I use this set value as field 'customerid.name' (set customer's name which is related to that invoice. ).

    It doesn't allows me to enter any dot notation rather asks me to pick up a lookup value. Undoubtedly business rules will save a lot of time, so any help would be highly appreciated.

  • Verified answer
    Aiden Kaskela Profile Picture
    Aiden Kaskela 19,692 on at
    RE: Event Handlers in Dynamics CRM 365

    Hi Mohd,

    Sure, happy to help!

    Javascript on forms happen when the form loads, you hit save, or a field changes. In each case, you can fire off javascript. A word of warning though - javascript and business rules don't play well together. If you have a business rule set Field A, the business rule doesn't fire the field changed event, so any javascript will not run.

    Here's the client side reference for javascript, it'll have all the details you need:

    msdn.microsoft.com/.../gg328255.aspx

    Here's a really good overview of setting up a form to run javascript:

    www.linkedin.com/.../getting-started-javascript-microsoft-dynamics-crm-hans-carlson

    Hope this helps! Let me know if you need any more resources.

    Thanks,

     Aiden

  • Mohd Tahir Profile Picture
    Mohd Tahir 676 on at
    RE: Event Handlers in Dynamics CRM 365

    Thanks for your response Aiden. Okay I am looking into how to use business rules with entities. Prior to CRM I have been into SharePoint and there using JavaScript was pretty straight forward. I have googled but didn't see much invaluable resources. If you could suggest on how to use JavaScript in CRM Dynamics 365 or share any good tutorials it would be really appreciable. I will mark the response as verified answer as well.

  • Verified answer
    Aiden Kaskela Profile Picture
    Aiden Kaskela 19,692 on at
    RE: Event Handlers in Dynamics CRM 365

    Hi,

    There are a few ways you can do it.

    Field Mappings are one way, but not that flexible. You'd set it up to map from entity to entity on create, so if you're on a contact and click New Order, it'll fill in some fields from the contact. Not very flexible.

    Business Rules are your best choice. They have a lot of the functionality you used to need javascript for but it's easy and configurable. You can hide or show fields, change requirement levels or set fields (even from other entities but it's not really documented). Here's details on Business Rules:

    technet.microsoft.com/.../dn531086.aspx

    If you need anything more complex than getting a value from a lookup record, you'll need to write javascript for that.

    Hope this helps! I'd appreciate if you'd mark this as Answering your question.

    Thanks,

     Aiden

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans