Get Records from Zoho Invoice by specifying record id

 Overview

The zoho.invoice.getrecordbyid() task can be executed to fetch records from any of the supported modules of Zoho Invoice by specifying the record ID. By placing it in the required form actions block of Zoho Creator, the process of fetching records form Zoho Invoice can easily be automated as per requirement. Lets say we have a Zoho Creator form where certain records need to be fetched from Zoho Invoice for further action such as performing an iteration. You can execute zoho.invoice.getrecordbyid() task in the required form actions block which will return the response containing the records in a map format. Further details on how to execute this task are explained below.

 Supported Modules

  • Invoices
  • CustomerPayments
  • Items
  • Contacts
  • Expenses
  • Estimates
  • ExpenseCategory

 Syntax

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

where,
<response> - is the map variable returned by Zoho Invoice as response. 
<moduleName> - name of module in Zoho Invoice from where the records will be fetched. (mandatory)
<organisation_id> - required org id from where the records will be fetched (mandatory). Following is an image displaying a sample Organization ID.

<record_id> - id of the record that needs to be fetched. (mandatory)

 Example

Following is a sample script that can be added in a Zoho Creator form to retrieve an existing record from Zoho Invoice based on the record ID. Let's say we have a Creator form where we need to fetch a particular record from Zoho Invoice. You can add the following script in required form actions block of the Creator Form so that whenever this form is loaded, edited or submitted etc, the specified record existing in Zoho Invoice's specified module is retrieved accordingly. In this case, the module is "Contacts". When the following script gets executed, the specified record from Zoho Invoice is fetched as per the specified record ID.

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

where,
response - is the map variable returned by Zoho Invoice as response. 
Contacts - name of module in Zoho Invoice from where the records will be fetched.
10982991 - sample Org ID from where the records will be fetched.
1687000000116001 - sample ID of the record that needs to be fetched.

 Response

Response returned by Zoho Invoice as map:

{
    "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"
    }
}

Failure Repsonse:

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