GraphQL executeAutomationCommand


#1

I am trying to put together a GQL mutation query to execute an Automation Command on a specific order line which I have the Order ID for. The button is on Automation Commands, it is enabled for all users and has the same name.

mutation {
  executeAutomationCommand(name: "Kitchen Order Ready", parameters: [{value: "BEKqLri_AEaYk_PAw6GC6Q"}], user: "Admin", terminal: "Server", department: "Restaurant", ticketType: "Ticket")
}

However I keep getting:

{
  "data": {
    "executeAutomationCommand": null
  },
  "errors": [
    {
      "ClassName": "GraphQL.ExecutionError",
      "Message": "Error trying to resolve executeAutomationCommand.",
      "Data": null,
      "InnerException": {
        "ClassName": "GraphQL.ExecutionError",
        "Message": "An argument with name \"event\" does not exist.",
        "Data": null,
        "InnerException": null,
        "HelpURL": null,
        "StackTraceString": "   at GraphQL.Types.ResolveFieldContext.Argument[TType](String name)\r\n   at Samba.Services.Graphql.Automation.NotifyEventMutation.ExecuteAutomationCommand(ResolveFieldContext context) in C:\\Users\\vehbi\\Source\\Repos\\sambapos-v5-pro\\Samba.Services\\Graphql\\Automation\\NotifyEventMutation.cs:line 152\r\n   at GraphQL.DocumentExecuter.<ResolveFieldAsync>d__8.MoveNext()",
        "RemoteStackTraceString": null,
        "RemoteStackIndex": 0,
        "ExceptionMethod": "8\nArgument\nGraphQL, Version=0.11.0.493, Culture=neutral, PublicKeyToken=null\nGraphQL.Types.ResolveFieldContext\nTType Argument[TType](System.String)",
        "HResult": -2146233088,
        "Source": "GraphQL",
        "WatsonBuckets": null
      },
      "HelpURL": null,
      "StackTraceString": null,
      "RemoteStackTraceString": null,
      "RemoteStackIndex": 0,
      "ExceptionMethod": null,
      "HResult": -2146233088,
      "Source": null,
      "WatsonBuckets": null
    }
  ]
}

Is my syntax correct or am I missing some parameters?

The docs say the following and that is a type string:

name: String! – The name of the Automation Command
parameters: [EventParameterInputType]
terminal: String!
department: String!
user: String!
ticketType: String!

In the other hand, is there any way to update an order state of an existing order line directly from GQL instead? I am having issues updating an already existing ticket order based on the orderId parameter so I am attempting to execute a command instead. I was attempting updateTicket mutation with no results.


#2

Looks like there is a validation issue there. Can you try adding event parameter like this to understand if it solves the issue or not?

mutation {
  executeAutomationCommand(name: "Kitchen Order Ready",event:"",...
}

#3

Hi!

I get “unknown argument “event” on field executeAutomationCommand of type mutation” popup on Graphiql.

I am not sure if I query this elsewhere it would do the same.