Skip to main content

ปรับปรุง Logic การจัดการข้อมูล Contact ในเอกสารด้วย contactId

อัปเดตเงื่อนไขการใช้ข้อมูลผู้ติดต่อ (Contact) เมื่อสร้างและแก้ไขเอกสาร

FlowAccount OpenAPI ได้มีการปรับปรุงการใช้งาน contactId ในการสร้างหรืออัปเดตเอกสาร เพื่อรองรับการเปลี่ยนแปลงข้อมูลผู้ติดต่อ (contact) ในรายการเอกสาร โดยมีรายละเอียดดังต่อไปนี้

ผู้ใช้งานสามารถทดสอบได้บน Sandbox

เริ่มมีผลบน Production Environment: 04/02/2026

รายละเอียดการเปลี่ยนแปลง

การปรับปรุงครั้งนี้เป็นการอัปเดตจากฟีเจอร์เดิมที่ประกาศ รองรับการระบุผู้ติดต่อด้วย contactId ในการจัดการเอกสาร โดยปรับปรุง Logic การใช้ข้อมูล contact เมื่อระบุ contactId

1. การใช้งาน

  1. เมื่อใส่ contactId ระบบจะดึงข้อมูลผู้ติดต่อของ contactId นั้นๆ มาใส่ค่าให้

  2. สามารถใส่ค่าข้อมูลผู้ติดต่อ เฉพาะเอกสารนั้นๆ ได้โดยไม่กระทบกับการแก้ไขข้อมูลผู้ติดต่อ โดยมีเงื่อนไข ดังนี้

    สำหรับ contactName และ contactCode:

    • ถ้าใส่ค่า ต้องใส่ค่าให้ถูกต้องตามข้อมูลของ contactId นั้นๆ
    • ถ้าไม่ใส่ค่า ระบบจะดึงค่าจากสมุดรายชื่อมาใส่ให้อัตโนมัติ

    สำหรับ field อื่นๆ:

    • contactAddress
    • contactTaxId
    • contactBranch
    • contactPerson
    • contactEmail
    • contactNumber
    • contactZipCode

    มี Logic ดังนี้:

    • ถ้าส่งฟิลด์มา → ใช้ค่าที่ส่งมา (รวมถึงค่าว่าง "")
    • ถ้าไม่ส่งฟิลด์มา → ดึงค่าข้อมูลของผู้ติดต่อมาใช้

2. ตัวอย่างการทำงาน

สมมติข้อมูลผู้ติดต่อที่มีอยู่ในสมุดรายชื่อ:

contactId: 100
contactName: "บริษัท ABC จำกัด"
contactCode: "ABC001"
contactAddress: "123 ถนนสุขุมวิท"
contactTaxId: "1234567890123"
contactBranch: "สำนักงานใหญ่"

สามารถสร้างรายชื่อได้จากเส้น POST /contacts

ตัวอย่างที่ 1: เเก้ไขบางฟิลด์

{
"contactId": 100,
"contactAddress": "",
"contactTaxId": "9876543210987"
}

ผลลัพธ์:

contactId: 100
contactName: "บริษัท ABC จำกัด" // จากสมุดรายชื่อ (fix)
contactCode: "ABC001" // จากสมุดรายชื่อ (fix)
contactAddress: "" // จาก payload (override เป็นค่าว่าง)
contactTaxId: "9876543210987" // จาก payload (override)
contactBranch: "สำนักงานใหญ่" // จากสมุดรายชื่อ (ไม่ได้ส่งมา)

ตัวอย่างที่ 2: ไม่เเก้ไขฟิลด์ใดเลย

{
"contactId": 100
}

ผลลัพธ์:

contactId: 100
contactName: "บริษัท ABC จำกัด" // จากสมุดรายชื่อ
contactCode: "ABC001" // จากสมุดรายชื่อ
contactAddress: "123 ถนนสุขุมวิท" // จากสมุดรายชื่อ
contactTaxId: "1234567890123" // จากสมุดรายชื่อ
contactBranch: "สำนักงานใหญ่" // จากสมุดรายชื่อ

3. Error Cases

กรณีError Message
contactId < 0ContactId cannot be less than 0
contactId ไม่มีในสมุดรายชื่อContactId not found
contactName หรือ contactCode ไม่ตรงกับในสมุดรายชื่อContactId, ContactName and ContactCode is mismatch
contactId ไม่ได้เป็นของ companyId นั้นContactId does not belong to the current company

APIs ที่ได้รับผลกระทบ

APIs สร้างเอกสารใบเสนอราคา (Quotations)

  • POST /quotations
  • POST /quotations/inline
  • PUT /quotations/{id}

APIs สร้างเอกสารใบวางบิล (Billing Notes)

  • POST /billing-notes
  • POST /billing-notes/inline
  • PUT /billing-notes/{id}

APIs สร้างเอกสารใบกำกับภาษี (Tax Invoices)

  • POST /tax-invoices
  • POST /tax-invoices/with-payment
  • POST /tax-invoices/inline
  • POST /tax-invoices/inline/with-payment
  • PUT /tax-invoices/{id}

APIs สร้างเอกสารใบเสร็จรับเงิน (Receipts)

  • PUT /receipts/{id}

APIs สร้างเอกสารใบกำกับภาษี/ใบเสร็จรับเงิน (Cash Invoices)

  • POST /cash-invoices
  • POST /cash-invoices/with-payment
  • POST /cash-invoices/inline
  • POST /cash-invoices/inline/with-payment

APIs สร้างเอกสารใบสั่งซื้อ (Purchase Orders)

  • POST /purchases-orders
  • POST /purchases-orders/inline
  • PUT /purchases-orders/{id}

APIs สร้างเอกสารใบรับสินค้า (Purchases)

  • POST /purchases
  • POST /purchases/with-payment
  • POST /purchases/inline
  • POST /purchases/inline/with-payment
  • PUT /purchases/{id}

APIs สร้างเอกสารค่าใช้จ่าย (Expenses)

  • POST /expenses
  • POST /expenses/with-payment
  • POST /expenses/inline
  • POST /expenses/inline/with-payment
  • PUT /expenses/{id}