javascript - Adding HTML Button to Dynamics CRM 2016 Form -
what i'm attempting add html button trigger simple javascript function. onclick, want see if field contains value of 0.00 - if remove value. or, if field not contain data, add in value of 0.00 should alternate between 2 values.
<html> <head> </head> <body> <button onclick="recalc">re-calculate balance</button> <script> function recalc() { var balancewriteoff = xrm.page.getattribute("jucy_balancewriteoff").getvalue(); if ((balancewriteoff) ==null) xrm.page.getattribute("balancewriteoff").setvalue("0"); xrm.page.data.entity.save(); if ((balancewriteoff) =="0") xrm.page.getattribute("jucy_balancewriteoff").setvalue(null); xrm.page.data.entity.save(); return; } </script> </body> </html>
when try run on form html element has been placed. nothing happening. i've thrown in break points @ var , both if statements , i'm not getting break when i'm triggering onclick event.
i'm kind of stumped here. if has insights me awesome
to access crm form fields html web resource, add script html:
<script src="clientglobalcontext.js.aspx" type="text/javascript"></script>
and prepend "parent" xrm.page object:
parent.xrm.page.getattribute("jucy_balancewriteoff").getvalue();
Comments
Post a Comment