Custom Function to sync Zoho Books Sales Order & Invoices to Zoho CRM Deals

Custom Function to sync Zoho Books Sales Order & Invoices to Zoho CRM Deals

Hi,

We are seeking some advise on how to create a custom function to sync our migrated Zoho Book's Sales Order and Invoices to the appropriate Deals in Zoho CRM. As we have the Zoho Books integrated to our Zoho CRM.

Currently we have imported historical Sales Order into Zoho Books and their corresponding Invoices. Some Invoices uploaded do not have Sales Order.
In Zoho CRM Deals, we have a custom single line text field "Sales Order Number" referring Sales Order number in Zoho Books.

Can anyone possibly have a draft deluge custom function that can go through all Sales Order (Zoho Books)and linked to the Deals in Zoho CRM and also sync Invoices (Zoho Books) to the Deals too?

Much help would be greatly appreciated.
Thanks