You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Coupa中提交带附件的cXML发票?求技术实现指导

Coupa cXML发票添加附件:用法解析与技术指南

Hey there! Let's dig into how to add attachments to Coupa cXML invoices using that documentation snippet you referenced. I'll break down the required code structure, key details, and practical tips to make this work smoothly.

1. 核心cXML代码片段

First off, you need to embed the attachment metadata directly within your cXML invoice's structure—typically inside the <InvoiceDetail> node (or the appropriate parent node per Coupa's specs). Here's the standard code block you'll need to add:

<Attachment>
  <Url>cid:invoice-support-001.pdf</Url>
  <MimeType>application/pdf</MimeType>
  <Description>Q3 2024 Invoice Supporting Receipt</Description>
  <FileName>Q3_2024_Invoice_Receipt.pdf</FileName>
</Attachment>

2. 关键节点详解

Let's break down each part to make sure you get it right:

  • <Url>: Uses the cid: prefix to link the cXML metadata to the actual attachment content in your MIME multipart request. The value after cid: must exactly match the Content-ID header of your attachment (more on this below).
  • <MimeType>: Specifies the file type of your attachment—common values include application/pdf, image/jpeg, application/vnd.openxmlformats-officedocument.wordprocessingml.document, etc. Double-check this matches your file's actual type.
  • <Description>: Optional but recommended—add a clear description so users in Coupa know what the attachment is for (e.g., "Receipt for Office Supplies Purchase").
  • <FileName>: The name that will display in Coupa's interface for the attachment. Use a descriptive name to avoid confusion later.

3. 完整请求的MIME多部分要求

Since you're sending an attachment, your entire cXML request needs to be sent as a multipart/related MIME message. Here's what you need to ensure:

  • Set the request's Content-Type header to multipart/related; boundary="unique-boundary-string" (replace unique-boundary-string with a string that doesn't appear anywhere in your cXML or attachment content).
  • Split the message into two parts:
    1. The first part is your cXML invoice body, with Content-Type: application/xml.
    2. The second part is your attachment, with headers like:
      Content-Disposition: attachment; filename="Q3_2024_Invoice_Receipt.pdf"
      Content-ID: <invoice-support-001.pdf>
      Content-Type: application/pdf
      
      Note that the Content-ID value (including the angle brackets) must match the cid: value in your cXML's <Url> node.

4. 测试与故障排查

Once you've set up the request, here's how to verify it works:

  • Use Coupa's Invoice Preview feature to check if the attachment shows up in the invoice details page.
  • If the attachment doesn't appear, double-check these common issues:
    • The MIME boundary string is correctly formatted and doesn't conflict with any content in your cXML or attachment.
    • The Content-ID of the attachment exactly matches the cid: value in the cXML (case-sensitive!).
    • The attachment file isn't corrupted, and its MIME type is correctly specified.
    • Your cXML is valid (run it through a cXML validator if you're unsure).

If you have specific snippets from that documentation screenshot or run into edge cases (like multiple attachments), feel free to share more details and I can help refine this further.

内容的提问来源于stack exchange,提问作者Gagan Bajaj

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 08:11:31