GQL executeAutomationCommand


I’ve been attempting to run an automation command from a nodejs app with the following query:

mutation check {
    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)
	settingValue = typeof settingValue == undefined ? '' : settingValue;
	var currentValue = "";
	var newValue = "";
	if(updateType == undefined)
		newValue = settingValue;
		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?

I’ve only ever (successfully) used the executeAutomationCommandForTerminalTicket mutation.

I have tried the straight executeAutomationCommand but that never worked and I just assumed I was messing something up (again).

I recall seeing a post by @markjw that used the notifyEvent mutation. I have not tried this one yet.

Judging from markjw’s comments, there is/are issues with the API and some things are not working like they used to. Jesse mentions some fixes for the API coming in 5.3.8.


Thanks for the reply Memo! Yeah, I tried a whole bunch of variations, but couldn’t figure out the executeAutomationCommand…Welp, time to wait for 5.3.8!!

This is totally me. XD