FSM work order creation on books quote approval

FSM work order creation on books quote approval

in order to create a work order in FSM based on a books quote being approved.  

I have changed the connection name to the one that connects my FSM and books but get the following error:

Check and update the code in line 27 as there is a Exception : Invalid JSON Format String



estimateID = estimate.get("estimate_id");
estimatedate = estimate.get("date").toDate();
organizationID = organization.get("organization_id");
resp = zoho.books.getRecordsByID("Estimates",organizationID,estimateID);
estimateResp = resp.get("estimate").toMap();
bl_address = estimateResp.get("billing_address").toMap().get("address");
bl_city = estimateResp.get("billing_address").toMap().get("city");
bl_country = estimateResp.get("billing_address").toMap().get("country");
bl_state = estimateResp.get("billing_address").toMap().get("state");
bl_zip = estimateResp.get("billing_address").toMap().get("zip");
sh_address = estimateResp.get("shipping_address").toMap().get("address");
sh_city = estimateResp.get("shipping_address").toMap().get("city");
sh_country = estimateResp.get("shipping_address").toMap().get("country");
sh_state = estimateResp.get("shipping_address").toMap().get("state");
sh_zip = estimateResp.get("shipping_address").toMap().get("zip");
summary = estimateResp.get("estimate_number");
due_date = estimateResp.get("date");
books_customer_id = estimateResp.get("contact_persons_details").toMap().get("contact_person_id");
con_response = invokeurl
[
type :GET
connection:"fsmconnection"
];
ContatsRespMap = con_response.get("data").toMap();
id = ContatsRespMap.get("id");
conDetails = zoho.fsm.getRecordById("Contacts",id);
data = conDetails.get("data");
Service_Address = data.toMap().get("Service_Address");
Billing_Address = data.toMap().get("Billing_Address");
Billing_Address_Id = Billing_Address.toMap().get("id");
Service_Address_Id = Service_Address.toMap().get("id");
service_Address_map = {"id":Service_Address_Id,"Service_Street_1":sh_address,"Service_Street_2":null,"Service_City":sh_city,"Service_State":sh_state,"Service_Country":sh_country,"Service_Zip_Code":sh_zip};
Billing_Address_map = {"id":Billing_Address_Id,"Billing_Street_1":bl_address,"Billing_Street_2":null,"Billing_City":bl_city,"Billing_State":bl_state,"Billing_Country":bl_country,"Billing_Zip_Code":bl_zip};
line_items = estimateResp.get("line_items").toList();
i = 1;
j = 1;
Service_Line_Items_List = list();
Part_Line_Items_List = list();
Sub_total = 0;
Tax_Amount = 0;
Grand_Total = 0;
tax = Map();
for each  line_item in line_items
{
item_id = line_item.toMap().get("item_id");
type = zoho.books.getRecordsByID("Items",organizationID,item_id).get("item").toMap().get("product_type");
if(type == "service")
{
Service_Line_Items_Map = Map();
line_item_name = line_item.toMap().get("name");
quantity = line_item.toMap().get("quantity");
tax_name = line_item.toMap().get("tax_name");
tax_id = line_item.toMap().get("tax_id");
tax_percentage = line_item.toMap().get("tax_percentage");
tax = {"Tax_Name":tax_name,"Tax_Exemption_Code":null,"Tax_Id":tax_id,"Tax_Percentage":tax_percentage,"Tax_Exemption_Id":null};
rate = line_item.toMap().get("rate");
ServiceResp = invokeurl
[
type :GET
connection:"fsmconnection"
];
ServiceRespMap = ServiceResp.toMap().get("data").toMap();
service_id = ServiceRespMap.get("id");
Service_Line_Items_Map.put("Service",service_id);
Service_Line_Items_Map.put("Quantity",quantity);
Service_Line_Items_Map.put("List_Price",rate);
Line_Item_Amount = quantity.toDecimal() * rate.toDecimal();
Sub_total = Sub_total + Line_Item_Amount;
Service_Line_Items_Map.put("Tax",tax);
Service_Line_Items_Map.put("Line_Item_Amount",Line_Item_Amount);
Service_Line_Items_Map.put("Sequence",i);
Service_Line_Items_Map.put("Contact",id);
i = i + 1;
Service_Line_Items_List.add(Service_Line_Items_Map);
}
else
{
Part_Line_Items_Map = Map();
line_item_name = line_item.toMap().get("name");
quantity = line_item.toMap().get("quantity");
tax_name = line_item.toMap().get("tax_name");
tax_id = line_item.toMap().get("tax_id");
tax_percentage = line_item.toMap().get("tax_percentage");
tax = {"Tax_Name":tax_name,"Tax_Exemption_Code":null,"Tax_Id":tax_id,"Tax_Percentage":tax_percentage,"Tax_Exemption_Id":null};
rate = line_item.toMap().get("rate");
ServiceResp = invokeurl
[
type :GET
connection:"fsmconnection"
];
ServiceRespMap = ServiceResp.toMap().get("data").toMap();
service_id = ServiceRespMap.get("id");
Part_Line_Items_Map.put("Part",service_id);
Part_Line_Items_Map.put("Quantity",quantity);
Part_Line_Items_Map.put("List_Price",rate);
Line_Item_Amount = quantity.toDecimal() * rate.toDecimal();
Sub_total = Sub_total + Line_Item_Amount;
Part_Line_Items_Map.put("Line_Item_Amount",Line_Item_Amount);
Part_Line_Items_Map.put("Tax",tax);
Part_Line_Items_Map.put("Sequence",j);
j = j + 1;
Part_Line_Items_List.add(Part_Line_Items_Map);
}
}
info Service_Line_Items_List;
temp_ser_line_item = Service_Line_Items_List.get(0).toMap();
temp_ser_line_item.put("Part_Line_Items",Part_Line_Items_List);
new_serv_list = list();
k = 0;
for each  serv_list_merge in Service_Line_Items_List
{
if(k == 0)
{
new_serv_list.add(temp_ser_line_item);
k = k + 1;
}
else
{
new_serv_list.add(serv_list_merge);
}
}
Tax_Amount = Sub_total * tax_percentage * 0.01;
Grand_Total = Sub_total + Tax_Amount;
terrResp = zoho.fsm.getRecords("Territories");
terrId = terrResp.get("data").toMap().get("id");
//Create work order
createMap = Map();
createMap.put("Summary",summary);
createMap.put("Due_Date",due_date);
createMap.put("Contact",id);
createMap.put("Type","Service");
createMap.put("Billing_Address",Billing_Address_map);
createMap.put("Service_Address",service_Address_map);
createMap.put("Territory",terrId);
createMap.put("Service_Line_Items",new_serv_list);
createMap.put("Tax_Amount",Tax_Amount);
createMap.put("Grand_Total",Grand_Total);
response = zoho.fsm.createRecord("Work_Orders",createMap);
info response;



        • Recent Topics

        • Kaizen #59 - Creating alerts and custom messages using Client Script

          Hello everyone! We are happy to resume our Zoho CRM Developer Community series - The Kaizen series! Welcome back to the new start of Kaizen! This post is about Client Script and its simple use cases involving ZDK Client functions. What is Client Script?
        • [Webinar] Zoho Writer for content creators and publishing houses

          Managing multiple drafts, edits, and client reviews doesn't have to slow you down. Join our upcoming webinar to see how Zoho Writer helps content creators and publishing houses create, edit, and publish seamlessly—all in one place. You'll learn how to:
        • Universal search

          Hi, it would be useful if the search bar was universal-so if you entered a term, it would bring up results from contacts, candidates, clients etc all at the same time (but broken down under the relevant headings)
        • Attachment reminder?

          My team and I often need to attach files to our messages, e.g. an explanatory screenshot or a shipping label. More often that I want to admit I mention the attachment but forget to actually attach it. Some email clients have a check-for-missing-attachments
        • New Customization options in the module builder: Quick Create and Detail view

          Hello everyone, We have introduced two new components to the module builder: Quick create and Detail view. The Quick Create Component It is a mini form used to create a record and associate it to the parent record from a lookup field. For example, if you have a Deals lookup in the Contacts module, then you can associate existing deals or create a deal and associate it with the contact. You can customize this Quick Create form by adding standard as well as custom fields. There is no limit to the number
        • Calendar not working

          Are we the only ones. On any browser we cannot click on any of our calendar appointments and get them to open. They just make the browser loop. WE have reached out and have been told they are working on it. The office staff are really stuck. The point
        • ZIA in Zoho Cliq

          Is It possible to use the ZIA feature from Zoho Analytics in the Zoho Cliq?
        • Automating CRM backup storage?

          Hi there, We've recently set up automatic backups for our Zoho CRM account. We were hoping that the backup functionality would not require any manual work on our end, but it seems that we are always required to download the backups ourselves, store them,
        • Multiple upload field CRM

          I desperately need the functionality to add more than one upload field to web to contacts form. How can I do this?
        • Good news! Calendar in Zoho CRM gets a face lift

          Dear Customers, We are delighted to unveil the revamped calendar UI in Zoho CRM. With a complete visual overhaul aligned with CRM for Everyone, the calendar now offers a more intuitive and flexible scheduling experience. What’s new? Distinguish activities
        • Critical Need for Global Search in Zoho FSM

          Hello Zoho FSM Team, We are currently in the process of deciding whether to fully transition to Zoho FSM for managing our field service operations. At present, our team actively uses Zoho Desk (with over 50 users) and Service Fusion, which we are considering
        • Collections Management: # 1 Payment Collection is All About Convenience

          "Sir, can you come tomorrow? My manager wasn't available for the cheque sign-off", the customer said, avoiding eye contact. Ravi forced a polite smile, but inside, he felt a sense of defeat. He had already visited the customer's office twice in the last
        • Can the Product Image on the Quote Template be enlarged

          Hello, I am editing the Quote Template and added ${Products.Product Image} to the line item and the image comes up but it is very tiny. Is there anyway that you can resize this to be larger? Any help would be great! Thanks
        • Deleting Fields in CRM Deletes Views in Analytics

          Hey friends! I'm having some issues when we modify some fields within ZohoCRM. There are times where we need to sunset a field and eventually completely remove it. In these instances, it seems like a lot of views are removed in Analytics. This ranges
        • Updating custom fields in Zoho Projects

          Hi I am wondering if anyone has experience with custom fields in Zoho Projects. I am struggling to update the field using either deluge or the api endpoint. My code is: //custom_Map = map(); custom_Map = {"UDF_DOUBLE_1":"0.27"}; update_Map = map(); update_Map.put("custom_fields",custom_Map.toList());
        • Audio/video quality issues with Zoho Meeting – Any roadmap for improvement?

          Hi Zoho Team, We’ve been using Zoho Meeting for both internal and external meetings, and unfortunately, the experience has been consistently poor. The video and audio quality are so unreliable that it often renders meetings ineffective—especially with
        • Paste issues in ZOHO crm notes

          Hi, since a week or so I have issues with the paste function in ZOHO CRM. I use "notes" to copy paste texts from Outlook emails and since a week or so, the pasting doesnt function as it should: some text just disappears and it gives a lot of empty lines/enters.....
        • Cash based businesses cannot use the new fixed asset module

          Hello all, If your bookkeeping is reporting in cash, you cannot use the new fixed acid module, as it does all the depreciation bookings accrual and not cash. This is definitive and you can't turn them into a cash booking. They will never appear in your
        • Zoho Learn & Zoho Connect

          Hi, Is there a way to sync the knowledge base we have in Zoho Learn with the manuals section is Zoho Connect? Thanks,
        • Modifying iframe data of Zoho booking iframe

          Hello, I have integrated a Zoho Bookings embedded iframe into my website. Currently, I am pre-filling the booking form with default values as part of our process flow. However, I want to ensure that if an input field is already populated with a default
        • Apply Payment Received Amount Zoho Books Invoice

          Hello team here is the sample code How can apply the payment received record over a unpaid zoho books invoice. //......................... paymentID = customer_payment.get("payment_id"); organizationID = organization.get("organization_id"); paymentmaplist
        • Enhance Sign CRM integration

          Hello all, I'm working on a custom Deluge script to enhance the integration between Zoho CRM and Sign by using a writer merge template for additional flexibility. I want to replicate the post-sign document integration that exists between CRM and Sign
        • Zoho Books Finance Modules Not Accessible in Zoho CRM Mobile App

          We have integrated Zoho CRM with Zoho Books using the Zoho Finance Suite integration. In the CRM web version, we can see the Finance modules (Estimates/Quotes, Invoices, Sales Orders, Items, Payments) and are able to create invoices and quotes directly
        • Does Zoho offer a full WhatsApp Marketing Platform (like WATI / GallaBox)?

          lm exploring WhatsApp marketing and I’d like to understand what options are available within the Zoho ecosystem. Currently, I see: Zoho SalesIQ has a broadcast option, but it seems very limited — for example, it doesn’t support uploading contacts via
        • Cliq iOS can't see shared screen

          Hello, I had this morning a video call with a colleague. She is using Cliq Desktop MacOS and wanted to share her screen with me. I'm on iPad. I noticed, while she shared her screen, I could only see her video, but not the shared screen... Does Cliq iOS is able to display shared screen, or is it somewhere else to be found ? Regards
        • [Live Webinar] New in Zoho WorkDrive: AI enhancements, Data Loss Prevention, Version Controls, and more

          Hello everyone, We're excited to bring you another round of powerful updates in Zoho WorkDrive! Join us on May 15 for an exclusive live webinar where we’ll unveil the latest features designed to enhance your team’s productivity, collaboration, and data
        • Live webinar: Streamlining legal operations: Leveraging Zoho WorkDrive for law firm success

          Hello everyone, Managing legal documents across departments and jurisdictions can be complex, but it doesn’t have to be. Join us on March 6 for an exclusive webinar where we’ll show you how Zoho WorkDrive empowers legal teams to stay compliant, organized,
        • Live Webinar: Optimizing back-office operations in the manufacturing industry to maximize profitability

          Hello everyone, We’re excited to invite you to our upcoming live webinar on February 6! Discover how Zoho WorkDrive can help manufacturing businesses optimize back-office operations, improve efficiency, and boost profitability. Our product experts will
        • Live webinar: 2024 recap of Zoho WorkDrive

          Hello everyone, We’re excited to invite you to our year-end live webinar! This session will take you through the transformative features and updates we’ve introduced in Zoho WorkDrive this year, helping you streamline document management like never before.
        • Live webinar: Explore WorkDrive's seamless integrations with key Zoho apps

          Hello everyone, We’re excited to invite you to our upcoming live webinar, where we'll delve into the seamless integration of WorkDrive with other key Zoho applications! This is a fantastic opportunity to enhance your productivity and streamline your workflows
        • Live webinar: Getting the most out of WorkDrive in Zoho Workplace

          Hello everyone, We’re excited to invite you to our upcoming live webinar, where we’ll explore how to maximize your use of WorkDrive as part of the Zoho Workplace bundle. This is a fantastic opportunity to elevate your productivity and streamline your
        • Live webinar: Mastering data migration, organization, and team collaboration

          Hello everyone, We’re excited to invite you to our upcoming live webinar! Discover how to seamlessly migrate your data, optimize file organization, and boost team collaboration using Zoho WorkDrive’s powerful features. This is a fantastic opportunity
        • BARCODE PICKLIST

          Hello! Does anyone know how the Picklist module works? I tried scanning the barcode using the UPC and EAN codes I added to the item, but it doesn’t work. Which barcode format does this module use for scanning?
        • Join our live webinar: Explore the WorkDrive TrueSync application!

          Hello everyone, We are thrilled to invite you to a live webinar focused on mastering the WorkDrive TrueSync application. Discover how to seamlessly sync your content between the cloud and your computer, ensuring smooth and efficient file management. Our
        • Bug tracking

          Hi, does anyone know how to track errors during picking or packing? This way I can keep track and see how to improve and prevent errors in this area.
        • Zoho Creator customer portal limitation | Zoho One

          I'm asking you all for any feedback as to the logic or reasoning behind drastically limiting portal users when Zoho already meters based on number of records. I'm a single-seat, Zoho One Enterprise license holder. If my portal users are going to add records, wouldn't that increase revenue for Zoho as that is how Creator is monetized? Why limit my customer portal to only THREE external users when more users would equate to more records being entered into the database?!? (See help ticket reply below.)
        • Script Editor not an option

          I am trying to apply a script to a sheet and Script Editor is not an option. I don't want to go outside Sheets to do this (like Creator) if it can be done inside Sheets.
        • Moving data from one pipeline to another

          Hey all, I've got some complex pipelines to build and I'd like to seperate them into seperate pipelines rather than have one mammoth one. If I create 2 pipelines, is there any easy way to use the output of Pipeline1 to be the input into Pipeline2? Or
        • Envio de mails

          Hola! No puedo enviar mails pero si recibirlos. No se como solucionarlo! Mi dominio es chidobebes.com.ar
        • ERROR CODE :554 - Your access to this mail system has been rejected due to poor reputation of a domain used in message transfer

          In my email configuration: The domain's MX Records are pointed to Zoho The domain's SPF Records have been pointed out successfully DKIM is enabled. DMARC Record is pointed for the domain. The domain name is digioorja.in. Still facing the issue of Error:
        • Next Page