在 Zoho Invoice 中更新记录

 概述

可执行 zoho.invoice.update() 任务以更新 Zoho Invoice 的任何受支持模块中的现有记录。通过将它放入 Zoho Creator 中所需的表单动作块,在 Zoho Invoice 中更新记录的过程可以根据需求轻松地实现自动化。假设您有一个 Zoho Creator 表单,用于编辑订单的发货单详情。若要同时在 Zoho Invoice 的“发货单”模块中编辑相同的详情,您可以执行“成功时”表单动作块中的 zoho.invoice.update() 任务。这样,每当编辑和提交带有新详细信息的 Zoho Creator 表单时,将在 Zoho Invoice 中更新指定的记录。有关如何执行此任务的更多详情在下面说明。

 支持的模块

  • 发货单
  • 客户付款
  • 项目
  • 联系人
  • 费用
  • 报价单
  • 费用类别

 语法

response =zoho.invoice.update(moduleName, organisation_id, record_id, {data_map})

其中,
<response> - 是作为响应由 Zoho Invoice 返回的映射变量。
<moduleName> - Zoho Invoice 中的模块名称,其中的记录将会更新。(必填)
<organisation_id> - 更新记录时必需的机构编号。下面是显示了示例机构编号的截图。

<record_id> - 需要更新的记录编号。(必填)
<dataMap> - 保存键值对的映射变量。映射键是 Zoho Invoice 模块中指定的标签名,映射值是在 ZC 表单中提交的字段值。例如,"First Name" : input.First_Name。在这里,"First Name” 是在 Zoho Invoice 模块中指定的标签名,input.First_Name 指的是在 Zoho Creator 表单的 First_Name 字段中指定的值。(必填)

 示例

下面是一个示例脚本,可添加到 Zoho Creator 表单中以在 Zoho Invoice 中编辑现有记录。假设我们有一个 Creator 表单,其中包含“名称”、“产品”、“数量”和“金额”字段,用于存储客户的订单详细信息。您可以将以下脚本添加到 Creator 表单的编辑时 -> 成功时块,以便每当编辑此表单时,Zoho Invoice 的指定模块中的现有详细信息也会相应地编辑。在本例中,模块是“发货单”。当执行以下脚本时,在此表单中更新的数量和金额值也会在 Zoho Invoice 的指定记录中更新。

response = zoho.invoice.update("Contacts", "10982991", 1687000000116001, {"contact_name" : input.Name});

其中,
response - 是作为响应由 Zoho Invoice 返回的映射变量。
Invoice - Zoho Invoice 中的模块名称,其中的记录将会更新。
10982991 - 其中的记录将会更新的示例机构编号。
"contact_name” 表示 Invoice 中的联系人名称,其对应值跟在冒号后面。
1687000000116001 - 需要更新记录的示例编号

 响应

Zoho Invoice 作为映射返回的响应:

{
"code": 0,
"message": "Contact information has been saved.",
"contact": {
"contact_id": "219715000000070001",
"contact_name": "sunil",
"company_name": "",
"website": "",
"language_code": "",
"language_code_formatted": "",
"contact_salutation": "",
"is_client_review_asked": false,
"has_transaction": false,
"contact_type": "customer", 
"owner_id": "",
"owner_name": "",
"source": "api",
"is_crm_customer": false,
"is_linked_with_zohocrm": false,
"primary_contact_id": "",
"zcrm_account_id": "",
"zcrm_contact_id": "",
"payment_terms": 0,
"payment_terms_label": "Due On Receipt",
"currency_id": "219715000000000099",
"currency_code": "INR",
"currency_symbol": "Rs.",
"price_precision": 2,
"outstanding_receivable_amount": 0,
"outstanding_receivable_amount_bcy": 0,
"unused_credits_receivable_amount": 0,
"unused_credits_receivable_amount_bcy": 0,
"status": "active",
"payment_reminder_enabled": true,
"is_client_review_settings_enabled": false,
"average_client_rating": "-0.0",
"custom_fields": [],
"billing_address": {
"address": "",
"city": "",
"state": "",
"zip": "",
"country": "",
"fax": ""
},
"shipping_address": {
"address": "",
"city": "",
"state": "",
"zip": "",
"country": "",
"fax": ""
},
"contact_persons": [],
"pricebook_id": "",
"pricebook_name": "",
"default_templates": {
"invoice_template_id": "",
"invoice_template_name": "",
"estimate_template_id": "",
"estimate_template_name": "",
"creditnote_template_id": "",
"creditnote_template_name": "",
"paymentthankyou_template_id": "",
"paymentthankyou_template_name": "",
"invoice_email_template_id": "",
"invoice_email_template_name": "",
"estimate_email_template_id": "",
"estimate_email_template_name": "",
"creditnote_email_template_id": "",
"creditnote_email_template_name": "",
"paymentthankyou_email_template_id": "",
"paymentthankyou_email_template_name": ""
},
"associated_with_square": false,
"cards": [],
"checks": [],
"bank_accounts": [],
"notes": "",
"created_time": "2016-02-08T13:21:54+0530",
"last_modified_time": "2016-02-08T13:24:10+0530"
}
}

失败响应:

{"message":"Contact does not exist.","code":1002}