Skip to main content
Solved

Is it possible to create fieldCondition using API?

  • October 19, 2020
  • 1 reply
  • 209 views

Nigel O'connell
Pipefy Staff

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'."
}
]
}

Best answer by Roberto Chavarria

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 

View original
Did this topic help you find an answer to your question?

1 reply

Roberto Chavarria
Pipefy Staff
Forum|alt.badge.img+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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings