How to Get the Books Invoice Sharing URL with Deluge?

How to Get the Books Invoice Sharing URL with Deluge?

I have managed to successfully create an invoice in zoho books from an invoice in zoho crm. However there are additional requirements to this script that seem to be an issues. 
  1. I need to get the zoho books invoice url after the zoho books invoice is created and post it back in the corresponding crm invoice record. I have researched this online and have concluded that the invoice must be first created in zoho books, then subsequently get the zoho books invoice record and update the status of the zoho books invoice to sent before getting the zoho books invoice_url. I am using custom fields in both zoho books {cf_zohocrm_invoice_id} and zoho crm {Zoho_Books_Id} to put the corresponding record ids to maintain the by directional sync. 
    1. How do I get the Zoho Books Invoice_url and post it back in the crm invoice?  Nothing that I have tried has worked! Can this be done with the same script used to created the zoho books invoice? This would be ideal! 
    2. If I use another workflow and custom script inside zoho books to update the zoho books invoice status to sent and get the zoho books invoice url, I will need to include {"trigger":{"workflow"}} in the zoho crm invoice deluge script that is use to create the zoho books invoice record. However adding  {"trigger":{"workflow"}} to the zoho crm custom function that creates the zoho books invoice has caused my function to error. Can you use  {"trigger":{"workflow"}} in zoho books? 
I have tried updating the zoho books invoice status manually and then running a script to get the "invoice_url" and it wont work. Also tried to update the zoho books invoice "status" via deluge and it work work either. 

I have tried 
.get("invoice_url");
.getJson("invoice_url");
.put("status","sent");




The script I am using to create the zoho books invoice. 

invoice = zoho.crm.getRecordById("Invoices",id);
Invoice_product_info = invoice.get("Product_Details");
accountcrmid = invoice.get("Account_Name").get("id");
accountdet = zoho.crm.getRecordById("Accounts",accountcrmid);
accountbooksid = accountdet.get("Zoho_Books_Id");
invoiceduedate = invoice.get("Due_Date");
invoice_no = invoice.get("Invoice_No");
Product_line_items = list();
for each  record in Invoice_product_info
{
productid = zoho.crm.getRecordById("Products",record.get("product").get("id"));
Booksid = productid.get("Zoho_Books_Id");
Products_map = Map();
Products_map.put("item_id",Booksid);
Products_map.put("quantity",record.get("quantity"));
Product_line_items.add(Products_map);
}
Invoice_line_items = Map();
Invoice_line_items.put("invoice_number",invoice_no);
Invoice_line_items.put("customer_id",accountbooksid);
Invoice_line_items.put("due_date",invoiceduedate);
Invoice_line_items.put("line_items",Product_line_items);
Create_invoice = zoho.books.createRecord("Invoices","xxxxxxxxx",Invoice_line_items);
info Create_invoice;
info Invoice_line_items;
ZBR = zoho.books.getRecordsByID("invoice","xxxxxxxxx",Create_invoice);
mp = Map();
mp.put("Zoho_Books_Id",ZBR);
upt = zoho.crm.updateRecord("Invoices",id,mp);
info upt;

The script I'm using to update the zoho crm invoice from zoho books. 
invoiceid = invoice.getJson("invoice_id");
zohocrmid = invoiceid.getJson("cf_zohocrm_invoice_id");
mp = Map();
mp.put("Status",invoiceid.getJson("status"));
mp.put("Invoice_URL",invoiceid.getJson("invoice_url"));
updat = zoho.crm.updateRecord("Invoices", zohocrmid, mp);
info mp;
info updat;
The error for this script 
  • Check and update the code in line 5 as there is a Exception : Invalid collection string





                            Zoho Desk Resources

                            • Desk Community Learning Series


                            • Digest


                            • Functions


                            • Meetups


                            • Kbase


                            • Resources


                            • Glossary


                            • Desk Marketplace


                            • MVP Corner


                            • Word of the Day



                                Zoho Marketing Automation


                                        Manage your brands on social media



                                                Zoho TeamInbox Resources

                                                  Zoho DataPrep Resources



                                                    Zoho CRM Plus Resources

                                                      Zoho Books Resources


                                                        Zoho Subscriptions Resources

                                                          Zoho Projects Resources


                                                            Zoho Sprints Resources


                                                              Qntrl Resources


                                                                Zoho Creator Resources


                                                                  Zoho WorkDrive Resources



                                                                    Zoho Campaigns Resources

                                                                      Zoho CRM Resources

                                                                      • CRM Community Learning Series

                                                                        CRM Community Learning Series


                                                                      • Tips

                                                                        Tips

                                                                      • Functions

                                                                        Functions

                                                                      • Meetups

                                                                        Meetups

                                                                      • Kbase

                                                                        Kbase

                                                                      • Resources

                                                                        Resources

                                                                      • Digest

                                                                        Digest

                                                                      • CRM Marketplace

                                                                        CRM Marketplace

                                                                      • MVP Corner

                                                                        MVP Corner

                                                                      





                                                                      




                                                                          Design. Discuss. Deliver.

                                                                          Create visually engaging stories with Zoho Show.

                                                                          Get Started Now