I am trying to enter data into a current field based on the selection of other fields. It was all working until I tried to enter in today's date. Now it is filling in the field before checking the conditions and for the date it says undefined. I get "Multifam_69_undefined.undefined.undefined_250_BRE_3" using the javascript below. All is correct other than where it should be the date and says undefined. Do you know where I am going wrong?
function PrintName()
{
var Vendor = Xrm.Page.getAttribute("new_printvendor").getValue();
var BRE = Xrm.Page.getAttribute("new_bre").getText();
var Invoice = Xrm.Page.getAttribute("new_invoicetemplate").getText();
var Batch = Xrm.Page.getAttribute("new_printbatch").getValue();
var Pages = Xrm.Page.getAttribute("new_printfileofpages").getValue();
var Name = Xrm.Page.getAttribute("new_printfilename").getValue();
if (BRE != null && Invoice != null && Batch != null && Pages != null && Name == null) {
var d = Date.now();
var PrintMonth = d.getMonth();
var PrintDay = d.getDay();
var PrintYear = d.getFullYear();
}
if (Vendor == 100000001) {
Xrm.Page.getAttribute("new_printfilename").setValue( "Multifam" + "_" + Invoice + "_" + PrintMonth + "." + PrintDay + "." + PrintYear + "_" + Pages + "_" + BRE + "_" + Batch);
}
if (Vendor == 100000000) {
Xrm.Page.getAttribute("new_printfilename").setValue( "Multifam" + "_" + PrintMonth + "." + PrintDay + "." + PrintYear + "_" + "BillOnly" + Invoice + "_" + Batch + "_" + Pages);
}
if (BRE == 100000000 && Vendor == 100000000) {
Xrm.Page.getAttribute("new_printfilename").setValue( "Multifam" + "_" + PrintMonth + "." + PrintDay + "." + PrintYear + "_" + Invoice + "_" + Batch + "_" + Pages);
}
}
*This post is locked for comments