Solved

Is it possible to create fieldCondition using API?

  • 19 October 2020
  • 1 reply
  • 109 views

Userlevel 5

Hi,
I have a use-case to copy field condition from one pipe to another. This is because clone pipe doesn't copy field conditions, I guess. Thanks!

mutation {
createFieldCondition (
input:
{
name: "condition1-CheckDeletedMessage",
condition:
{
expressions:
[
{
operation: "number_greater_than",
value: 50,
id: "check-message-count",
field_address: "test"
}
]
},
actions:
[
{
actionId: "show",
whenEvaluator: true,
phaseId: 7682176,
id:15723877,
phaseFieldId: "number_of_deleted_messages"
},
{
actionId: "hide",
whenEvaluator: false,
phaseId: 7682176,
id:15723877,
phaseFieldId: "number_of_deleted_messages"
}
]
})
{
clientMutationId
fieldCondition
{
id
name
}
}
}

Response:
{
"errors": [
{
"fields": [
"mutation",
"createFieldCondition",
"input"
],
"locations": [
{
"column": 10,
"line": 1
}
],
"message": "Argument 'input' on Field 'createFieldCondition' has an invalid value. Expected type 'createFieldConditionInput!'."
},
{
"fields": [
"mutation",
"createFieldCondition",
"input",
"condition"
],
"locations": [
{
"column": 37,
"line": 1
}
],
"message": "Argument 'condition' on InputObject 'createFieldConditionInput' has an invalid value. Expected type 'ConditionInput'."
},
{
"fields": [
"mutation",
"createFieldCondition",
"input",
"condition",
"expressions"
],
"locations": [
{
"column": 81,
"line": 1
}
],
"message": "Argument 'expressions' on InputObject 'ConditionInput' has an invalid value. Expected type '[ConditionExpressionInput]'."
},
{
"fields": [
"mutation",
"createFieldCondition",
"input",
"condition",
"expressions",
"value"
],
"locations": [
{
"column": 95,
"line": 1
}
],
"message": "Argument 'value' on InputObject 'ConditionExpressionInput' has an invalid value. Expected type 'String'."
}
]
}

icon

Best answer by Roberto Chavarria 19 October 2020, 23:56

View original

1 reply

Userlevel 5
Badge +5

Hi Nigel! The mutation’s correct setup would look like this:
 

mutation {
createFieldCondition(input:{
name: "condition1-CheckDeletedMessage"
condition: {
expressions: [
{operation: "number_greater_than",
value: "50",
field_address:"number_title"}
]}
actions: [
{actionId: "show"
whenEvaluator: true
phaseId: 8304435
phaseFieldId: "dbtest"}
{actionId: "hide"
whenEvaluator: false
phaseId: 8304435
phaseFieldId: "dbtest"}
]}) {
clientMutationId
fieldCondition {
id
name
}
}
}

You can change this according to fit your pipe/phase/field’s IDs 

Reply