JavaScript CRM 2015 setValue() triggering onChange

I'm trying to use the built in setValue() funtion in CRM 2015 to change a field back to null if a confirm() command comes back as false. The field that triggers the confirm() is also the field I am trying to set to null.

The code is as follows:

if (optionSetField.getValue() == 805430000 /*YES*/) {

        var tempBoolean = confirm("Test", "test Title")
        if (tempBoolean == false) {

            optionSetField.setValue(null)
        }

The field I am trying to set to null is an option set field with "yes" and "no" as the available options. I found this preferable to use over a bit field as it meant I did not require a default value.

Upon the code triggering and the user clicking 'Cancel' the setValue(null) triggers the onChange event, which despite the field supposedly being set to null asks for confirmation again. Is there something I'm doing wrong or is this a potential bug? Is there an alternate suggestion for what I am doing?

According to the Microsoft tech docs setValue() should not trigger onChange events, but clearly this is not the case. Anyone's insight would be helpful!

See here for the docs: https://msdn.microsoft.com/en-us/library/gg334409.aspx#BKMK_setValue

Answer:1

You should use confirmDialog, since it's callback-based it should allow the field to update itself properly.

Xrm.Utility.confirmDialog(message, yesCallback, noCallback)

So like this

if (optionSetField.getValue() === 805430000) {
    Xrm.Utility.confirmDialog("Test", function(){
        optionSetField.setValue(null);
    });
}

This would also work on tablets (confirm, on the other hand, won't)

Answer:2

I want to make a command called _ram it should display the current usage of the bots ram. I already tried these things: ${client.performance.memory} //(Says memory is not defined) ${window....

I want to make a command called _ram it should display the current usage of the bots ram. I already tried these things: ${client.performance.memory} //(Says memory is not defined) ${window....

  1. check current memory usage linux
  2. check current cpu usage linux
  3. check current bandwidth usage
  4. check current ram usage linux
  5. check current psu usage
  6. check current data usage on iphone
  7. check current power usage pc
  8. check current ulimit usage
  9. check current internet usage
  10. check current network usage linux
  11. aws check current usage
  12. check current bandwidth usage linux
  13. check current sga usage
  14. check current pga usage
  15. check current tempdb usage
  16. check current memory usage python
  17. check current data usage verizon
  18. check current data usage at&t
  19. check current ram usage
  20. check current memory usage aix

I've created the following DOM using Jquery: <div id="d0" class="choiceDiv"> <input type="checkbox" id="cb0" class=".userCheckBox" value="Option 1" checked="checked"> <input ...

I've created the following DOM using Jquery: <div id="d0" class="choiceDiv"> <input type="checkbox" id="cb0" class=".userCheckBox" value="Option 1" checked="checked"> <input ...

  1. jquery find find child
  2. jquery find find
  3. jquery find after find
  4. jquery find parent find

I want to call my ajax function untill already run ajax not give a response Page is load on every sec and every sec ajax function call but i want to call ajax untill already run ajax function is not ...

I want to call my ajax function untill already run ajax not give a response Page is load on every sec and every sec ajax function call but i want to call ajax untill already run ajax function is not ...

  1. call ajax function from html
  2. call ajax function on button click
  3. call ajax function on page load
  4. call ajax function from javascript
  5. call ajax function every 5 seconds
  6. call ajax function on press enter key
  7. call ajax function onclick
  8. call ajax function from php
  9. call ajax function in jquery
  10. call ajax function after page load
  11. call ajax function on link click
  12. call ajax function on select change
  13. call ajax function on anchor click
  14. call ajax function in wordpress
  15. call ajax function from code behind c#
  16. call ajax function on button click in asp.net
  17. call ajax function multiple times
  18. call ajax function on form submit
  19. call ajax function on dropdown change
  20. call ajax function from another ajax function

I have a problem on how to rearrange my panels on mobile. The panels have different sizes. Pls see attach for the screenshot of the page in large screen (col-lg): EDIT: The large screen layout is ok, ...

I have a problem on how to rearrange my panels on mobile. The panels have different sizes. Pls see attach for the screenshot of the page in large screen (col-lg): EDIT: The large screen layout is ok, ...