通过指定记录编号 从 Zoho Invoice 获取记录

 概述

可执行 zoho.invoice.getrecordbyid() 任务,通过指定记录编号从 Zoho Invoice 的任何受支持模块提取记录。通过将它放入 Zoho Creator 中所需的表单动作块,从 Zoho Invoice 提取记录的过程可以根据需求轻松地实现自动化。假设我们有一个 Zoho Creator 表单,它需要从 Zoho Invoice 提取某些记录以采取进一步动作,例如,执行迭代。您可以在所需的表单动作块执行 zoho.invoice.getrecordbyid() 任务,它将返回包含映射格式记录的响应。有关如何执行此任务的更多详情在下面说明。

 支持的模块

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

 语法

response =zoho.invoice. getrecordbyid(moduleName, organisation_id, record_id)

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

<record_id> - 需要提取的记录编号。(必填)

 示例

下面是一个示例脚本,可添加到 Zoho Creator 表单中以基于记录编号 从 Zoho Invoice 取回现有记录。假设我们有一个 Creator 表单,我们需要从 Zoho Invoice 将特定记录提取到该表单中。您可以将以下脚本添加到 Creator 表单中的所需表单动作块,以便每当加载、编辑或提交此表单时,Zoho Invoice 的指定模块中现有的指定记录会相应地取回。在本例中,模块是“联系人”。当执行以下脚本时,来自 Zoho Invoice 的指定记录将依照指定的记录编号 来提取。

response = zoho.invoice.getrecordbyid("Contacts", "10982991", 1687000000116001);

其中,
response - 是作为响应由 Zoho Invoice 返回的映射变量。
Contacts - Zoho Invoice 中的模块名称,记录将从这里提取。
10982991 - 示例机构编号,记录将从中提取。
1687000000116001 - 需要提取的记录的示例编号。

 响应

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

{
"code": 0,
"message": "success",
"contact": {
"contact_id": "219715000000050001",
"contact_name": "Bala",
"company_name": "Bowman and Co",
"website": "http://www.bowmanfurniture.com%22%2C/
"language_code": "",
"language_code_formatted": "",
"contact_salutation": "",
"is_client_review_asked": false,
"has_transaction": true,
"contact_type": "customer",
"owner_id": "",
"owner_name": "",
"source": "api",
"is_crm_customer": false,
"is_linked_with_zohocrm": false,
"primary_contact_id": "219715000000052001",
"zcrm_account_id": "",
"zcrm_contact_id": "",
"payment_terms": 15,
"payment_terms_label": "Net 15",
"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": "4900 Hopyard Rd, Suite 310",
"city": "Pleasanton",
"state": "CA",
"zip": "94588",
"country": "USA",
"fax": " 1-925-924-9600"
},
"shipping_address": {
"address": "Suite 125, McMillan Avenue",
"city": "San Francisco",
"state": "CA",
"zip": "94134",
"country": "USA",
"fax": " 1-925-924-9600"
},
"contact_persons": [
{
"contact_person_id": "219715000000052001",
"salutation": "Mr.",
"first_name": "Will",
"last_name": "Smith",
"email": "willsmith@bowmanfurniture.com",
"phone": " 1-925-921-9201",
"mobile": " 1-4054439562",
"zcrm_contact_id": "",
"is_added_in_portal": false,
"can_invite": true,
"is_primary_contact": true,
"is_portal_invitation_accepted": false
}
],
"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": "Payment option : Through check",
"created_time": "2015-11-30T16:25:32+0530",
"last_modified_time": "2015-11-30T16:29:34+0530"
}
}

失败响应:

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