I have this js but it is not changing the value of the two options field. I want it to always change the value from true to false, or false to true. Any help is appreciated.
function test() { debugger; value = Xrm.Page.getAttribute("new_convertleadwithoutopportunity").getValue(); alert(value); if (value = false) { Xrm.Page.getAttribute("new_convertleadwithoutopportunity").setValue(true); } else { Xrm.Page.getAttribute("new_convertleadwithoutopportunity").setValue(false); } Xrm.Page.data.refresh(true);}
*This post is locked for comments
Thank you!!
You need to use == to test for an equality in js. Use:
if (value == false) {
Xrm.Page.getAttribute("new_convertleadwithoutopportunity").setValue(true);
}
else {
Xrm.Page.getAttribute("new_convertleadwithoutopportunity").setValue(false);
}
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156