PIPEDRIVE: How could I Update a Deal that info is from previous Nodes

Hello,
I have a sheet node that retrieves a list of values, and I want to search if the records is on pipedrive and if yes will update some info if not will create a Person > Deal.

My issue is, imagine that my sheet list has 10 records. I will create pipedrive search operation using my term field that is on my sheet list.

Lets suppose that my search node just find 1 record that was on fifth position in my sheet list, how could I sync my fifth position record in sheets to my update operation pipedrive node to update the record with correct information in pipedrive.

Thanks if someone could help me.

Hi @rodrigoscdc,

So you essentially want to keep your Google Sheet record following after the Pipedrive node performing the search (to then perform actions based on whether you found a result or not)?

With the item number and order returned by after the your Pipedrive node not being predictable, I’d go for the Split In Batches node in such a scenario and split my Sheet data in batches of 1.

In this example flow, I am setting some dummy search data, then split my items in batches and run the Pipedrive search for each batch while also passing along the search data before merging both pieces back together. I’m then using an IF node to check whether a Deal ID was returned by the previous Pipedrive node. Subsequently, I could then update a deal as all data would be available (Pipedrive result + the data used to search it in the first place).

Example Workflow
{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "operation": "search",
        "term": "={{$json[\"search_term\"]}}",
        "additionalFields": {}
      },
      "name": "Pipedrive",
      "type": "n8n-nodes-base.pipedrive",
      "typeVersion": 1,
      "position": [
        900,
        300
      ],
      "alwaysOutputData": false,
      "credentials": {
        "pipedriveApi": {
          "id": "21",
          "name": "myPipedriveAccount"
        }
      }
    },
    {
      "parameters": {
        "functionCode": "return [{\n  json: {\n    search_term: 'foo'\n  }\n}, {\n  json: {\n    search_term: 'bar'\n  }\n}, {\n  json: {\n    search_term: 'baz'\n  }\n}]"
      },
      "name": "Set Example Data",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        460,
        300
      ]
    },
    {
      "parameters": {
        "batchSize": 1,
        "options": {}
      },
      "name": "SplitInBatches",
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 1,
      "position": [
        680,
        300
      ]
    },
    {
      "parameters": {},
      "name": "Keep Incoming Data",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        900,
        100
      ]
    },
    {
      "parameters": {
        "mode": "mergeByIndex"
      },
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "typeVersion": 1,
      "position": [
        1120,
        300
      ]
    },
    {
      "parameters": {},
      "name": "Perform Update Here",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        1560,
        300
      ]
    },
    {
      "parameters": {},
      "name": "Do Nothing",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        1560,
        100
      ]
    },
    {
      "parameters": {
        "conditions": {
          "number": [
            {
              "value1": "={{$json[\"id\"]}}",
              "operation": "isEmpty"
            }
          ]
        }
      },
      "name": "Deal ID Empty?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        1340,
        300
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Set Example Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pipedrive": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Set Example Data": {
      "main": [
        [
          {
            "node": "SplitInBatches",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SplitInBatches": {
      "main": [
        [
          {
            "node": "Pipedrive",
            "type": "main",
            "index": 0
          },
          {
            "node": "Keep Incoming Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Keep Incoming Data": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "SplitInBatches",
            "type": "main",
            "index": 0
          },
          {
            "node": "Deal ID Empty?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Deal ID Empty?": {
      "main": [
        [
          {
            "node": "Do Nothing",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Perform Update Here",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Is this what you had in mind?

Thanks @MutedJam this worked for me.

1 Like