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
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)
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....
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 ...
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 ...
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, ...