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'); customFieldList.add(customFieldMap1); // 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.
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....
Learn to create a customized inventory report with Zoho Analytics. This tutorial contains a link to our GitHub page for SQL code that will help with your table creations....
How nice would it be if you could, at the press of a button, send clients an email w/a Zoho Books invoice? Replete with “Pay Now” buttons that link to PayPal/Stripe/other payment gateways?...
Whether you work primarily out of CRM or the Zoho Finance Suite, you can use Analytics to build commissions dashboards. This involves some fairly simple SQL code....
If you are an inventory manager, this blog post could change your life. If you are not, it will at least teach you how to build some wicked inventory tracking for your business....
Convert fields, related activities, attachments, notes and more from one record to another across modules via custom function....