Javascripting Help Question

0
Hello all I'm not too familiar with Javascripting. I'm trying to execute this javascript as a form is about to be submitted. But it doesn't appear to be working. I'm not sure what I'm doing wrong, any help is appreciated!

CopyValuesToField([
{display:"", field: "Title"},
{display:"Required Date", field: "REQUIRED_DATE"},
{display:"New Print Queue(s)?", field: "Queuetype"}
], "DESCRIPTION", "", "\n\n", false);

switch (new (getFieldValue("PrinterCount"))){
case 1:
CopyValuesToField([
{display:"Print Queue Type", field: "PrintQueue_1"},
{display:"Printer IP", field: "PrinterIP_1"},
{display:"Queue #", field: "QueueNum_1"},
{display:"Model", field: "PrinterModel_1"},
{display:"duplex", field: "duplex_1"},
{display:"Orientation", field: "Orientation_1"},
{display:"Paper Source", field: "paperSrc_1"}
], "DESCRIPTION", "Printer 1\n----------------------------------------\n", "\n\n", true);
break;
case 2:
CopyValuesToField([
{display:"Print Queue Type", field: "PrintQueue_1"},
{display:"Printer IP", field: "PrinterIP_1"},
{display:"Queue #", field: "QueueNum_1"},
{display:"Model", field: "PrinterModel_1"},
{display:"duplex", field: "duplex_1"},
{display:"Orientation", field: "Orientation_1"},
{display:"Paper Source", field: "paperSrc_1"}
], "DESCRIPTION", "Printer 1\n----------------------------------------\n", "\n\n", true);
CopyValuesToField([
{display:"Print Queue Type", field: "PrintQueue_2"},
{display:"Printer IP", field: "PrinterIP_2"},
{display:"Queue #", field: "QueueNum_2"},
{display:"Model", field: "PrinterModel_2"},
{display:"duplex", field: "duplex_2"},
{display:"Orientation", field: "Orientation_2"},
{display:"Paper Source", field: "paperSrc_2"}
], "DESCRIPTION", "Printer 2\n----------------------------------------\n", "\n\n", true);
break;
case 3:
CopyValuesToField([
{display:"Print Queue Type", field: "PrintQueue_1"},
{display:"Printer IP", field: "PrinterIP_1"},
{display:"Queue #", field: "QueueNum_1"},
{display:"Model", field: "PrinterModel_1"},
{display:"duplex", field: "duplex_1"},
{display:"Orientation", field: "Orientation_1"},
{display:"Paper Source", field: "paperSrc_1"}
], "DESCRIPTION", "Printer 1\n----------------------------------------\n", "\n\n", true);
CopyValuesToField([
{display:"Print Queue Type", field: "PrintQueue_2"},
{display:"Printer IP", field: "PrinterIP_2"},
{display:"Queue #", field: "QueueNum_2"},
{display:"Model", field: "PrinterModel_2"},
{display:"duplex", field: "duplex_2"},
{display:"Orientation", field: "Orientation_2"},
{display:"Paper Source", field: "paperSrc_2"}
], "DESCRIPTION", "Printer 2\n----------------------------------------\n", "\n\n", true);
CopyValuesToField([
{display:"Print Queue Type", field: "PrintQueue_3"},
{display:"Printer IP", field: "PrinterIP_3"},
{display:"Queue #", field: "QueueNum_3"},
{display:"Model", field: "PrinterModel_3"},
{display:"duplex", field: "duplex_3"},
{display:"Orientation", field: "Orientation_3"},
{display:"Paper Source", field: "paperSrc_3"}
], "DESCRIPTION", "Printer 3\n----------------------------------------\n", "\n\n", true);
break;
case 4:
CopyValuesToField([
{display:"Print Queue Type", field: "PrintQueue_1"},
{display:"Printer IP", field: "PrinterIP_1"},
{display:"Queue #", field: "QueueNum_1"},
{display:"Model", field: "PrinterModel_1"},
{display:"duplex", field: "duplex_1"},
{display:"Orientation", field: "Orientation_1"},
{display:"Paper Source", field: "paperSrc_1"}
], "DESCRIPTION", "Printer 1\n----------------------------------------\n", "\n\n", true);
CopyValuesToField([
{display:"Print Queue Type", field: "PrintQueue_2"},
{display:"Printer IP", field: "PrinterIP_2"},
{display:"Queue #", field: "QueueNum_2"},
{display:"Model", field: "PrinterModel_2"},
{display:"duplex", field: "duplex_2"},
{display:"Orientation", field: "Orientation_2"},
{display:"Paper Source", field: "paperSrc_2"}
], "DESCRIPTION", "Printer 2\n----------------------------------------\n", "\n\n", true);
CopyValuesToField([
{display:"Print Queue Type", field: "PrintQueue_3"},
{display:"Printer IP", field: "PrinterIP_3"},
{display:"Queue #", field: "QueueNum_3"},
{display:"Model", field: "PrinterModel_3"},
{display:"duplex", field: "duplex_3"},
{display:"Orientation", field: "Orientation_3"},
{display:"Paper Source", field: "paperSrc_3"}
], "DESCRIPTION", "Printer 3\n----------------------------------------\n", "\n\n", true);
CopyValuesToField([
{display:"Print Queue Type", field: "PrintQueue_4"},
{display:"Printer IP", field: "PrinterIP_4"},
{display:"Queue #", field: "QueueNum_4"},
{display:"Model", field: "PrinterModel_4"},
{display:"duplex", field: "duplex_4"},
{display:"Orientation", field: "Orientation_4"},
{display:"Paper Source", field: "paperSrc_4"}
], "DESCRIPTION", "Printer 4\n----------------------------------------\n", "\n\n", true);
break;
case 5:
CopyValuesToField([
{display:"Print Queue Type", field: "PrintQueue_1"},
{display:"Printer IP", field: "PrinterIP_1"},
{display:"Queue #", field: "QueueNum_1"},
{display:"Model", field: "PrinterModel_1"},
{display:"duplex", field: "duplex_1"},
{display:"Orientation", field: "Orientation_1"},
{display:"Paper Source", field: "paperSrc_1"}
], "DESCRIPTION", "Printer 1\n----------------------------------------\n", "\n\n", true);
CopyValuesToField([
{display:"Print Queue Type", field: "PrintQueue_2"},
{display:"Printer IP", field: "PrinterIP_2"},
{display:"Queue #", field: "QueueNum_2"},
{display:"Model", field: "PrinterModel_2"},
{display:"duplex", field: "duplex_2"},
{display:"Orientation", field: "Orientation_2"},
{display:"Paper Source", field: "paperSrc_2"}
], "DESCRIPTION", "Printer 2\n----------------------------------------\n", "\n\n", true);
CopyValuesToField([
{display:"Print Queue Type", field: "PrintQueue_3"},
{display:"Printer IP", field: "PrinterIP_3"},
{display:"Queue #", field: "QueueNum_3"},
{display:"Model", field: "PrinterModel_3"},
{display:"duplex", field: "duplex_3"},
{display:"Orientation", field: "Orientation_3"},
{display:"Paper Source", field: "paperSrc_3"}
], "DESCRIPTION", "Printer 3\n----------------------------------------\n", "\n\n", true);
CopyValuesToField([
{display:"Print Queue Type", field: "PrintQueue_4"},
{display:"Printer IP", field: "PrinterIP_4"},
{display:"Queue #", field: "QueueNum_4"},
{display:"Model", field: "PrinterModel_4"},
{display:"duplex", field: "duplex_4"},
{display:"Orientation", field: "Orientation_4"},
{display:"Paper Source", field: "paperSrc_4"}
], "DESCRIPTION", "Printer 4\n----------------------------------------\n", "\n\n", true);
CopyValuesToField([
{display:"Print Queue Type", field: "PrintQueue_5"},
{display:"Printer IP", field: "PrinterIP_5"},
{display:"Queue #", field: "QueueNum_5"},
{display:"Model", field: "PrinterModel_5"},
{display:"duplex", field: "duplex_5"},
{display:"Orientation", field: "Orientation_5"},
{display:"Paper Source", field: "paperSrc_5"}
], "DESCRIPTION", "Printer 5\n----------------------------------------\n", "\n\n", true);
break;
}

Accepted Answer

Thursday, January 21 2016, 11:02 AM - #Permalink
0
Found my issue! I had new declaring a function and a typo in the GetFieldValue call.




CopyValuesToField([
{display:"", field: "Title"},
{display:"Required Date", field: "REQUIRED_DATE"},
{display:"New Print Queue(s)?", field: "Queuetype"}
], "DESCRIPTION", "", "\n\n", false);

switch ((GetFieldValue("PrinterCount"))){
case "1":
CopyValuesToField([
{display:"Print Queue Type", field: "PrintQueue_1"},
{display:"Printer IP", field: "PrinterIP_1"},
{display:"Queue #", field: "QueueNum_1"},
{display:"Model", field: "PrinterModel_1"},
{display:"duplex", field: "duplex_1"},
{display:"Orientation", field: "Orientation_1"},
{display:"Paper Source", field: "paperSrc_1"}
], "DESCRIPTION", "Printer 1\n----------------------------------------\n", "\n\n", true);
break;
case "2":
CopyValuesToField([
{display:"Print Queue Type", field: "PrintQueue_1"},
{display:"Printer IP", field: "PrinterIP_1"},
{display:"Queue #", field: "QueueNum_1"},
{display:"Model", field: "PrinterModel_1"},
{display:"duplex", field: "duplex_1"},
{display:"Orientation", field: "Orientation_1"},
{display:"Paper Source", field: "paperSrc_1"}
], "DESCRIPTION", "Printer 1\n----------------------------------------\n", "\n\n", true);
CopyValuesToField([
{display:"Print Queue Type", field: "PrintQueue_2"},
{display:"Printer IP", field: "PrinterIP_2"},
{display:"Queue #", field: "QueueNum_2"},
{display:"Model", field: "PrinterModel_2"},
{display:"duplex", field: "duplex_2"},
{display:"Orientation", field: "Orientation_2"},
{display:"Paper Source", field: "paperSrc_2"}
], "DESCRIPTION", "Printer 2\n----------------------------------------\n", "\n\n", true);
break;
case "3":
CopyValuesToField([
{display:"Print Queue Type", field: "PrintQueue_1"},
{display:"Printer IP", field: "PrinterIP_1"},
{display:"Queue #", field: "QueueNum_1"},
{display:"Model", field: "PrinterModel_1"},
{display:"duplex", field: "duplex_1"},
{display:"Orientation", field: "Orientation_1"},
{display:"Paper Source", field: "paperSrc_1"}
], "DESCRIPTION", "Printer 1\n----------------------------------------\n", "\n\n", true);
CopyValuesToField([
{display:"Print Queue Type", field: "PrintQueue_2"},
{display:"Printer IP", field: "PrinterIP_2"},
{display:"Queue #", field: "QueueNum_2"},
{display:"Model", field: "PrinterModel_2"},
{display:"duplex", field: "duplex_2"},
{display:"Orientation", field: "Orientation_2"},
{display:"Paper Source", field: "paperSrc_2"}
], "DESCRIPTION", "Printer 2\n----------------------------------------\n", "\n\n", true);
CopyValuesToField([
{display:"Print Queue Type", field: "PrintQueue_3"},
{display:"Printer IP", field: "PrinterIP_3"},
{display:"Queue #", field: "QueueNum_3"},
{display:"Model", field: "PrinterModel_3"},
{display:"duplex", field: "duplex_3"},
{display:"Orientation", field: "Orientation_3"},
{display:"Paper Source", field: "paperSrc_3"}
], "DESCRIPTION", "Printer 3\n----------------------------------------\n", "\n\n", true);
break;
case "4":
CopyValuesToField([
{display:"Print Queue Type", field: "PrintQueue_1"},
{display:"Printer IP", field: "PrinterIP_1"},
{display:"Queue #", field: "QueueNum_1"},
{display:"Model", field: "PrinterModel_1"},
{display:"duplex", field: "duplex_1"},
{display:"Orientation", field: "Orientation_1"},
{display:"Paper Source", field: "paperSrc_1"}
], "DESCRIPTION", "Printer 1\n----------------------------------------\n", "\n\n", true);
CopyValuesToField([
{display:"Print Queue Type", field: "PrintQueue_2"},
{display:"Printer IP", field: "PrinterIP_2"},
{display:"Queue #", field: "QueueNum_2"},
{display:"Model", field: "PrinterModel_2"},
{display:"duplex", field: "duplex_2"},
{display:"Orientation", field: "Orientation_2"},
{display:"Paper Source", field: "paperSrc_2"}
], "DESCRIPTION", "Printer 2\n----------------------------------------\n", "\n\n", true);
CopyValuesToField([
{display:"Print Queue Type", field: "PrintQueue_3"},
{display:"Printer IP", field: "PrinterIP_3"},
{display:"Queue #", field: "QueueNum_3"},
{display:"Model", field: "PrinterModel_3"},
{display:"duplex", field: "duplex_3"},
{display:"Orientation", field: "Orientation_3"},
{display:"Paper Source", field: "paperSrc_3"}
], "DESCRIPTION", "Printer 3\n----------------------------------------\n", "\n\n", true);
CopyValuesToField([
{display:"Print Queue Type", field: "PrintQueue_4"},
{display:"Printer IP", field: "PrinterIP_4"},
{display:"Queue #", field: "QueueNum_4"},
{display:"Model", field: "PrinterModel_4"},
{display:"duplex", field: "duplex_4"},
{display:"Orientation", field: "Orientation_4"},
{display:"Paper Source", field: "paperSrc_4"}
], "DESCRIPTION", "Printer 4\n----------------------------------------\n", "\n\n", true);
break;
case "5":
CopyValuesToField([
{display:"Print Queue Type", field: "PrintQueue_1"},
{display:"Printer IP", field: "PrinterIP_1"},
{display:"Queue #", field: "QueueNum_1"},
{display:"Model", field: "PrinterModel_1"},
{display:"duplex", field: "duplex_1"},
{display:"Orientation", field: "Orientation_1"},
{display:"Paper Source", field: "paperSrc_1"}
], "DESCRIPTION", "Printer 1\n----------------------------------------\n", "\n\n", true);
CopyValuesToField([
{display:"Print Queue Type", field: "PrintQueue_2"},
{display:"Printer IP", field: "PrinterIP_2"},
{display:"Queue #", field: "QueueNum_2"},
{display:"Model", field: "PrinterModel_2"},
{display:"duplex", field: "duplex_2"},
{display:"Orientation", field: "Orientation_2"},
{display:"Paper Source", field: "paperSrc_2"}
], "DESCRIPTION", "Printer 2\n----------------------------------------\n", "\n\n", true);
CopyValuesToField([
{display:"Print Queue Type", field: "PrintQueue_3"},
{display:"Printer IP", field: "PrinterIP_3"},
{display:"Queue #", field: "QueueNum_3"},
{display:"Model", field: "PrinterModel_3"},
{display:"duplex", field: "duplex_3"},
{display:"Orientation", field: "Orientation_3"},
{display:"Paper Source", field: "paperSrc_3"}
], "DESCRIPTION", "Printer 3\n----------------------------------------\n", "\n\n", true);
CopyValuesToField([
{display:"Print Queue Type", field: "PrintQueue_4"},
{display:"Printer IP", field: "PrinterIP_4"},
{display:"Queue #", field: "QueueNum_4"},
{display:"Model", field: "PrinterModel_4"},
{display:"duplex", field: "duplex_4"},
{display:"Orientation", field: "Orientation_4"},
{display:"Paper Source", field: "paperSrc_4"}
], "DESCRIPTION", "Printer 4\n----------------------------------------\n", "\n\n", true);
CopyValuesToField([
{display:"Print Queue Type", field: "PrintQueue_5"},
{display:"Printer IP", field: "PrinterIP_5"},
{display:"Queue #", field: "QueueNum_5"},
{display:"Model", field: "PrinterModel_5"},
{display:"duplex", field: "duplex_5"},
{display:"Orientation", field: "Orientation_5"},
{display:"Paper Source", field: "paperSrc_5"}
], "DESCRIPTION", "Printer 5\n----------------------------------------\n", "\n\n", true);
break;
}
The reply is currently minimized Show
Responses (0)
  • There are no replies here yet.
Your Reply

Recent Tweets