Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Formtype Change event

Posted on by Microsoft Employee

Hello, 

I have a entity which has 2 forms. 

Is there a way to fire an event when user changes the form. Like displaying alert etc..

I want to set some field value when user changes the form manually. 

Regards

Prasad. 

*This post is locked for comments

  • Suggested answer
    ansrikanth Profile Picture
    ansrikanth 3,115 on at
    RE: Formtype Change event

    The form Onload is the only event that can help you on this. If the user changes the form then onload event will fire, The first step you have to do in the onload is, check what is the form name using the formSelector, based on that you can take further required action like setting a field value, showing an alert or even forcing user to shift to another form.. Hope this helps....

  • Verified answer
    Mahadeo Matre Profile Picture
    Mahadeo Matre 17,021 on at
    RE: Formtype Change event

    Hi,

    When user manually change form, then Form is loaded again, so you can add logic in form load event, and based on current form you can set values to fields.

    You need to add onload event on both forms.

    you can get current form name/ id using

    var formname =  Xrm.Page.ui.formSelector.getCurrentItem.getLabel();

    var formId =  Xrm.Page.ui.formSelector.getCurrentItem.getId();

    msdn.microsoft.com/.../gg327828.aspx

    msdn.microsoft.com/.../gg309560.aspx

    Another option is even you have 2 forms you can enable security on forms, and based on user role you can show form to user.

    Hope this will help..

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,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans