Hi!
I’ve been attempting to run an automation command from a nodejs app with the following query:
mutation check {
executeAutomationCommand(
name: "Test",
terminal: "Server",
department: "Takeout",
user: "Admin",
ticketType: "Ticket")
}
With the Automation Command Rule being:
Which the script will update a global setting as a test.
function updateGlobal(settingName,settingValue,updateType)
{
if(typeof settingName == undefined)
return;
settingValue = typeof settingValue == undefined ? '' : settingValue;
var currentValue = "";
var newValue = "";
if(updateType == undefined)
newValue = settingValue;
else
{
currentValue = readGlobal(settingName);
if (updateType == 'decrease')
newValue = Helper.ToNumber(currentValue[settingName]) - settingValue;
else if (updateType == 'increase')
newValue = Helper.ToNumber(currentValue[settingName]) + settingValue;
}
var qry = 'mutation m {setting:updateGlobalSetting(name:"'+ settingName + '",value:"' + newValue + '"){name,value}}';
var result = exec(qry);
newValue = result.setting.value;
return newValue;
}
The response I get is:
{
"data": {
"executeAutomationCommand": "OK"
},
"errors": null
}
Nothing happens, so unsure how to do this. I’ve tried searching the forum for other posts, but couldn’t find any relevant solutions.
Am I using it wrong? Does it have to be used for tickets?