Get & Update Invoice Custom Fields in Zoho Books

Difficulty: Beginner
Estimated reading time: 5 mins
Estimated implementation time: 15 mins

Zoho Books Custom Fields

This script will get custom field records from an Invoice, then update the custom fields on the Invoice.


This function is intented to run in Zoho Books. You must have custom fields on the record you are working on. Learn to create custom fields in Zoho Books here.

Note: Only custom fields with values will appear in the custom_fields key in the Invoice record.

					// Get Record and Organization Variables
invoiceId = invoice.get('invoice_id');
organizationId = organization.get('organization_id');

 Get Custom Fields from Record
// Get Custom Fields and Iterate over each Custom Field
customFields = invoice.get('custom_fields').toList();
for each  customField in customFields
	label = customField.get('label');
	value = customField.get('value');

 Update Custom Fields on Record
// Create List of Custom Fields
customFieldList = List();
customFieldMap1 = Map();
customFieldMap1.put('label', 'YOUR CUSTOM FIELD LABEL');
customFieldMap1.put('value', 'YOUR CUSTOM FIELD VALUE');

// Create Map for Updating the Invoice
updateInvoiceMap = Map();
updateInvoiceMap.put('custom_fields', customFieldList);

// Update Invoice
updateInvoice = zoho.books.updateRecord('Invoices', organizationId, invoiceId, updateInvoiceMap);
info updateInvoice;

Click here to copy these scripts. For more Zoho-wizardry, check out our GitHub page.

Want to learn even more? Sign up for one of our Zoho courses!

More Free Resources

Deluge Tips – Null Check

When scripting, ask yourself this question – will this value ever be null? If it’s a yes, that’s a place for a null check! Here are 3 tips and best practices to help you kickstart the habit.

Read More »