I’m using 5.3.2 and trying to Execute Automation Command via graphql to update an entity, however I am getting an error message when testing that makes no sense. First tried using executeAutomationCommand
…
GraphQL:
mutation m{executeAutomationCommand(
name:"Update Customer",
parameters:[
{name:"EntityName", value:"1234"},
{name:"FirstName", value:"Mark"},
{name:"LastName", value:"Wallace"},
{name:"Street", value:"123 Any Street"},
{name:"Town", value:"Anytown"},
{name:"PostCode", value:"AA1 1AA"},
{name:"Email", value:"test@example.com"}
],
user:"Admin",
ticketType:"Delivery",
terminal:"Server",
department:"Delivery / Collection"
)}
Response:
{
"data": {
"executeAutomationCommand": null
},
"errors": [
{
"locations": [
{
"line": 0,
"column": 0
}
],
"message": "Error trying to resolve executeAutomationCommand.",
"data": {},
"innerException": {
"ClassName": "System.MissingMethodException",
"Message": "No parameterless constructor defined for this object.",
"Data": null,
"InnerException": null,
"HelpURL": null,
"StackTraceString": " at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)\r\n at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)\r\n at System.Activator.CreateInstance(Type type, Boolean nonPublic)\r\n at System.Activator.CreateInstance(Type type)\r\n at GraphQL.ObjectExtensions.ToObject(IDictionary`2 source, Type type)\r\n at GraphQL.ObjectExtensions.GetPropertyValue(Object propertyValue, Type fieldType)\r\n at GraphQL.ObjectExtensions.GetPropertyValue[T](Object value)\r\n at GraphQL.Types.ResolveFieldContext.Argument[TType](String name)\r\n at Samba.Services.Graphql.Automation.NotifyEventMutation.<.ctor>b__6_0(ResolveFieldContext context) in C:\\Users\\Vehbi\\Documents\\Source\\Repos\\sambapos-v5-pro\\Samba.Services\\Graphql\\Automation\\NotifyEventMutation.cs:line 112\r\n at GraphQL.DocumentExecuter.<ResolveFieldAsync>d__8.MoveNext()",
"RemoteStackTraceString": null,
"RemoteStackIndex": 0,
"ExceptionMethod": "8\nCreateInstance\nmscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\nSystem.RuntimeTypeHandle\nSystem.Object CreateInstance(System.RuntimeType, Boolean, Boolean, Boolean ByRef, System.RuntimeMethodHandleInternal ByRef, Boolean ByRef)",
"HResult": -2146233069,
"Source": "mscorlib",
"WatsonBuckets": null,
"MMClassName": null,
"MMMemberName": null,
"MMSignature": null
},
"stackTrace": null,
"helpLink": null,
"source": null,
"hResult": -2146233088
}
]
}
When this didn’t work, I tried using notifyEvent
as described here…
…but I get a similar error when running that as well…
GraphQL:
mutation m{notifyEvent(
event:"AutomationCommandExecuted",
parameters:[
{name:"AutomationCommandName",value:"Update Customer"},
{name:"EntityName", value:"1234"},
{name:"FirstName", value:"Mark"},
{name:"LastName", value:"Wallace"},
{name:"Street", value:"123 Any Street"},
{name:"Town", value:"Anytown"},
{name:"PostCode", value:"AA1 1AA"},
{name:"Email", value:"test@example.com"}
],
user:"Admin",
ticketType:"Delivery",
terminal:"Server",
department:"Delivery / Collection",
state:{ticket:{id:0}}
){ticket{id}}}
Response:
{
"data": {
"notifyEvent": null
},
"errors": [
{
"locations": [
{
"line": 0,
"column": 0
}
],
"message": "Error trying to resolve notifyEvent.",
"data": {},
"innerException": {
"ClassName": "System.MissingMethodException",
"Message": "No parameterless constructor defined for this object.",
"Data": null,
"InnerException": null,
"HelpURL": null,
"StackTraceString": " at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)\r\n at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)\r\n at System.Activator.CreateInstance(Type type, Boolean nonPublic)\r\n at System.Activator.CreateInstance(Type type)\r\n at GraphQL.ObjectExtensions.ToObject(IDictionary`2 source, Type type)\r\n at GraphQL.ObjectExtensions.GetPropertyValue(Object propertyValue, Type fieldType)\r\n at GraphQL.ObjectExtensions.GetPropertyValue[T](Object value)\r\n at GraphQL.Types.ResolveFieldContext.Argument[TType](String name)\r\n at Samba.Services.Graphql.Automation.NotifyEventMutation.<.ctor>b__6_1(ResolveFieldContext context) in C:\\Users\\Vehbi\\Documents\\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\nCreateInstance\nmscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\nSystem.RuntimeTypeHandle\nSystem.Object CreateInstance(System.RuntimeType, Boolean, Boolean, Boolean ByRef, System.RuntimeMethodHandleInternal ByRef, Boolean ByRef)",
"HResult": -2146233069,
"Source": "mscorlib",
"WatsonBuckets": null,
"MMClassName": null,
"MMMemberName": null,
"MMSignature": null
},
"stackTrace": null,
"helpLink": null,
"source": null,
"hResult": -2146233088
}
]
}
I have the rule and action setup as follows:
Before doing all this, I have also tried using the updateEntityCustomData
mutation to update the entity custom data directly from GraphQL, however there appears to be a bug with that mutation that only updates the entity randomly, hence why I’m trying the above ways.