Hi!
I’ve changed the rule, tested it a bunch, and I’m unsure if I’m doing something wrong, or if it’s a bug, but I am trying to implement a rule that updates the {TICKET TAG:Pickup Date} with the date the order is supposed to be picked up on.
↓
↓
SHOULD BE THIS:
But nothing gets updated:
Below are the rules/script:
Once Future Date is selected it will fire this rule
function returnPickupDateNew()
{
var date = new Date();
var today = new Date();
date.setMilliseconds(today.getMilliseconds());
date.setSeconds(today.getSeconds());
date.setMinutes(today.getMinutes());
date.setHours(today.getHours());
date.setDate(date.getDate()+1);
var change;
while(change != "Ok" && change != "Cancel")
{
change = dlg.AskQuestion("Pickup Date<br/>" + date.toString(),"- Month=m,- Week=w,- Day=d,+ Day=D,+ Week=W,+ Month=M,Ok,Cancel");
switch (change)
{
case "w":
date.setDate(date.getDate()-7);
break;
case "m":
date.setMonth(date.getMonth()-1);
break;
case "d":
date.setDate(date.getDate()-1);
break;
case "W":
date.setDate(date.getDate()+7);
break;
case "M":
date.setMonth(date.getMonth()+1);
break;
case "D":
date.setDate(date.getDate()+1);
break;
}
if(change == "Ok")
{
if(date <= today)
{
dlg.ShowMessage("Please select a date in the future");
date.setMonth(today.getMonth());
date.setYear(today.getMonth());
date.setDate(today.getDate() + 1);
change = "";
}
}
}
if(change == "Cancel")
{
cmd.Execute("Set Future Pickup Date:Cancel");
}
else
{
var returnString = date.getMonth() + 1;
//return (date.getMonth() + 1) + "/" + date.getDate() + "/" + date.getYear();
cmd.Execute("Set Future Pickup Date:" + (date.getMonth() + 1) + "/" + date.getDate() + "/" + date.getYear());
}
}
(The return statement that is commented out returns “7/4/2021”)
This will fire the automation command:
Pretty much all of the actions that update the tags/states on the ticket do not work…BUT the Show Message does show “test” dialogue box…
Yet when I try it with a test button:
As well as calling this:
These both work.
So I’m completely stumped…I’ve tried making new rules, changing scripts, but still not getting any luck.
Any insight, ideas, or help would be appreciated!!
Thank you!