Good Morning All..
I am trying to do something quite simple with our CRM System Microsoft Dynamics CRM 2011.
Basically i am creating a javascript web resource and asking a field to execute with onLoad.
Everything is working fine with the scripts i've created at the moment, but having trouble implementing divisions.
The script is:
function gprecurringnew()
{
var estrevrecurring = Xrm.Page.getAttribute('new_estrevenuerecurring').getValue();
var coshardware = Xrm.Page.getAttribute('new_coshardwareallowance').getValue();
var contractterm = Xrm.Page.getAttribute('new_contractterm').getValue();
var coscashback = Xrm.Page.getAttribute('new_coscashback').getValue();
var cosmonthlycosts = Xrm.Page.getAttribute('new_monthlycosts').getValue();
if(estrevrecurring==null)return;
if(coshardware==null)return;
if(contractterm==null)return;
if(coscashback==null)return;
if(cosmonthlycosts==null)return;
var gprecurring = estrevrecurring - coshardware / conractterm - coscashback / contractterm - cosmonthlycosts
Xrm.Page.getAttribute('new_gprecurring').setValue(gprecurring);
}
And the calcuation should be:
GP Recurring = Est Revenue Recurring, minus the Cost of Sales Hardware (coshardware) divided by the Contract Term (contractterm), minus the Cashback (coscashback) divided by the Contract Term, minus the Cost fo Sales Monthly Costs.
At the moment the script doesn't work and i assume due to the way i've laid out the actual calculations? Can anyone help a JS newbie?
I am trying to do something quite simple with our CRM System Microsoft Dynamics CRM 2011.
Basically i am creating a javascript web resource and asking a field to execute with onLoad.
Everything is working fine with the scripts i've created at the moment, but having trouble implementing divisions.
The script is:
function gprecurringnew()
{
var estrevrecurring = Xrm.Page.getAttribute('new_estrevenuerecurring').getValue();
var coshardware = Xrm.Page.getAttribute('new_coshardwareallowance').getValue();
var contractterm = Xrm.Page.getAttribute('new_contractterm').getValue();
var coscashback = Xrm.Page.getAttribute('new_coscashback').getValue();
var cosmonthlycosts = Xrm.Page.getAttribute('new_monthlycosts').getValue();
if(estrevrecurring==null)return;
if(coshardware==null)return;
if(contractterm==null)return;
if(coscashback==null)return;
if(cosmonthlycosts==null)return;
var gprecurring = estrevrecurring - coshardware / conractterm - coscashback / contractterm - cosmonthlycosts
Xrm.Page.getAttribute('new_gprecurring').setValue(gprecurring);
}
And the calcuation should be:
GP Recurring = Est Revenue Recurring, minus the Cost of Sales Hardware (coshardware) divided by the Contract Term (contractterm), minus the Cashback (coscashback) divided by the Contract Term, minus the Cost fo Sales Monthly Costs.
At the moment the script doesn't work and i assume due to the way i've laid out the actual calculations? Can anyone help a JS newbie?