{
  "name": "Automate weekly timesheet reporting with Salesforce, OpenAI and Gmail",
  "nodes": [
    {
      "id": "676e445e-8fe6-432d-9371-0e06c3a115d2",
      "name": "Timesheet",
      "type": "n8n-nodes-base.salesforce",
      "position": [
        -752,
        352
      ]
    },
    {
      "id": "06b42733-6505-4874-998a-df63693fe09f",
      "name": "Send a message",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1552,
        544
      ]
    },
    {
      "id": "041ae955-a28b-4c5e-8c8b-c46f07588396",
      "name": "Salesforce - Get Employee Details",
      "type": "n8n-nodes-base.salesforce",
      "position": [
        -256,
        416
      ]
    },
    {
      "id": "6547e5bb-b552-4643-848a-29631cc54618",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -240,
        -80
      ]
    },
    {
      "id": "28ede689-c8e9-46e5-acaa-61028ea0872d",
      "name": "OpenAI1",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        432,
        -64
      ]
    },
    {
      "id": "74b7ce82-ae9e-462e-b171-5b765408022d",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        64,
        368
      ]
    },
    {
      "id": "82f0c792-da55-4da6-b6d6-55234ea3188a",
      "name": "Salesforce - Get Employee Details1",
      "type": "n8n-nodes-base.salesforce",
      "position": [
        0,
        800
      ]
    },
    {
      "id": "908909ee-1431-4554-8c4e-2715be9bf473",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -960,
        352
      ]
    },
    {
      "id": "a3fdc924-5c85-4f34-bb23-201c2c29d0fb",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1552,
        80
      ],
      "parameters": {
        "width": 464,
        "height": 656,
        "content": "# Weekly Timesheet Automation — Overview \n\n## How it works\nThis workflow runs every week to fetch employee timesheet status and work details from Salesforce. It identifies who has submitted and who ha"
      }
    },
    {
      "id": "9c61b1df-4d7e-4351-9c93-e5c683c2019f",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -512,
        -176
      ],
      "parameters": {
        "width": 1360,
        "height": 352,
        "content": "## Submitted Timesheet Processing & AI Summary\nThis section processes only submitted timesheets. It collects detailed project line items, converts them into a readable structure, and uses AI to genera"
      }
    },
    {
      "id": "0126bcd5-a7cd-457f-8e3e-a5721f3b56b2",
      "name": "Get Timesheet Line Items",
      "type": "n8n-nodes-base.salesforce",
      "position": [
        -16,
        -64
      ]
    },
    {
      "id": "d9f0a4a3-f460-45d2-ac6e-0a64b9f86fb0",
      "name": "Generate HTML Table",
      "type": "n8n-nodes-base.code",
      "position": [
        208,
        -64
      ]
    },
    {
      "id": "18613e5b-dbda-4c3f-8aa9-3cf4c8c63bf7",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -336,
        272
      ],
      "parameters": {
        "width": 1056,
        "height": 304,
        "content": "## Employee Data & Submitted Summary Preparation\nThis section attaches employee profile details to each submitted timesheet, links the AI-generated summary to the correct employee, and prepares the fu"
      }
    },
    {
      "id": "59314e3b-5b44-49ab-bcbc-b3fe0c012ef7",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        672
      ],
      "parameters": {
        "width": 1328,
        "height": 304,
        "content": "## Pending Timesheet Tracking\nThis section identifies employees who have not submitted their timesheet. It fetches their contact details and prepares a clean list of pending submissions for manager vi"
      }
    },
    {
      "id": "d99d6315-d6ab-4366-9f5c-210a3c0a572d",
      "name": "Sticky Note15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1024,
        400
      ],
      "parameters": {
        "width": 704,
        "height": 304,
        "content": "## Final Report Creation & Manager Notification\nThis section merges both submitted and pending timesheet sections into one final weekly report and automatically sends the combined email to managers."
      }
    },
    {
      "id": "ccce948b-94b8-42b7-abc1-0dc0dccd7aee",
      "name": "Merge AI Summary",
      "type": "n8n-nodes-base.merge",
      "position": [
        352,
        352
      ]
    },
    {
      "id": "27ce803b-ab38-454e-94cd-58a6b1c580df",
      "name": "Prepare Submitted Section",
      "type": "n8n-nodes-base.code",
      "position": [
        576,
        352
      ]
    },
    {
      "id": "335825d9-4842-49c5-a5e4-3ee1e56de579",
      "name": "Merge Pending Info",
      "type": "n8n-nodes-base.merge",
      "position": [
        352,
        784
      ]
    },
    {
      "id": "e30a18f0-812e-4025-915b-0a27f649b07f",
      "name": "Merge Submitted + Pending",
      "type": "n8n-nodes-base.merge",
      "position": [
        1136,
        544
      ]
    },
    {
      "id": "69f58122-d857-49dd-a977-43200c3264ba",
      "name": "Prepare Pending Section",
      "type": "n8n-nodes-base.code",
      "position": [
        576,
        784
      ]
    },
    {
      "id": "4fb96899-e8df-4773-a5d3-72123034166b",
      "name": "Create Final Email",
      "type": "n8n-nodes-base.code",
      "position": [
        1328,
        544
      ]
    },
    {
      "id": "06313814-b4fe-4fb7-954a-5256d92dedb0",
      "name": "Sticky Note18",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1040,
        224
      ],
      "parameters": {
        "width": 512,
        "height": 288,
        "content": "## Schedule & Timesheet Fetching\nThis section runs every Friday and fetches all employee timesheets for the previous week from Salesforce."
      }
    },
    {
      "id": "45729a4c-d739-442a-9345-dab1b4c26193",
      "name": "If New Timesheet",
      "type": "n8n-nodes-base.if",
      "position": [
        -304,
        816
      ]
    },
    {
      "id": "0b1cae80-7d2e-46d7-b4b3-78e47cc38d3a",
      "name": "If Submitted Timesheet",
      "type": "n8n-nodes-base.if",
      "position": [
        -464,
        16
      ]
    }
  ],
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Merge AI Summary",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "OpenAI1": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Timesheet": {
      "main": [
        [
          {
            "node": "Salesforce - Get Employee Details",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          },
          {
            "node": "If New Timesheet",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge Pending Info",
            "type": "main",
            "index": 0
          },
          {
            "node": "If Submitted Timesheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a message": {
      "main": [
        []
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Merge AI Summary",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Timesheet Line Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If New Timesheet": {
      "main": [
        [
          {
            "node": "Salesforce - Get Employee Details1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge AI Summary": {
      "main": [
        [
          {
            "node": "Prepare Submitted Section",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Timesheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Final Email": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Pending Info": {
      "main": [
        [
          {
            "node": "Prepare Pending Section",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate HTML Table": {
      "main": [
        [
          {
            "node": "OpenAI1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If Submitted Timesheet": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Pending Section": {
      "main": [
        [
          {
            "node": "Merge Submitted + Pending",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Get Timesheet Line Items": {
      "main": [
        [
          {
            "node": "Generate HTML Table",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Submitted + Pending": {
      "main": [
        [
          {
            "node": "Create Final Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Submitted Section": {
      "main": [
        [
          {
            "node": "Merge Submitted + Pending",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Salesforce - Get Employee Details": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Salesforce - Get Employee Details1": {
      "main": [
        [
          {
            "node": "Merge Pending Info",
            "type": "main",
            "index": 1
          }
        ]
      ]
    }
  }
}