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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

JavaScript Web Resource on Check Box field type

(0) ShareShare
ReportReport
Posted on by

I have a Check Box field on a Quick Create Lead form and I want to perform some action when ever this field is selected(Checked) on OnChange Event. I have created a JavaScript Web Resource and it is performing the action whenever the check box field is selected(Checked), but the problem here is that it is performing that action even when the check box field is Unchecked. 

How to prevent that action while user is trying to Uncheck the check box field?   

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Radu Chiribelea Profile Picture
    6,667 on at

    Hi Sunny,

    This is expected behavior. The event handler is triggered on the on change event. Both checking and unchecking the box are considered on change events.

    To prevent the logic from being executed when the box is unchecked, you can add some extra logic inside the onchage method and verify the value of the field. If it is null simply return.

    Something llike

    function OnChangehandler(){

    var field = Xrm.Page.getAttribute("<your_checkboxfield">)

    if(field==false){

    return}

    else{

    //your logic here

    }

    }

    Hope this helps,

    Radu

  • Community Member Profile Picture
    on at

    I applied the same function and it worked for me, thanks Radu

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans