Converting Sales Order to Purchase Order

Converting Sales Order to Purchase Order

Hi All, 

Firstly, this code works to convert a sales order(SO) to a purchase order (PO) via a button, however I am running into an issue when I convert the SO where the values from the line items are not pulled across from the SO to the PO. 

The ones in question are the Discount/Adjustment, Wholesale Price and Maker Price.

I think the code below first references the Product module record first hence the API names, Euro Price for Maker Price and Wholesale_Price_1 for the Wholesale Price.


Below is the code I am using, it may also be something simple where I shouldn't be using the API names but the field names and vice versa - if anyone could assist with this would be grateful. 

string button.PO_from_SO(String soId)
{
respMap = zoho.crm.getRecordById("Sales_Orders",soId.toLong());
productDet = ifnull(respMap.get("Product_Details"),list());
pdlist = List();
for each  eachProd in productDet
{
productvalue = eachProd.get("product");
proid = productvalue.get("id");
proname = productvalue.get("name");
mp = Map();
mp.put("product",{"name":proname,"id":proid});
mp.put("quantity",ifnull(eachProd.get("quantity"),"0").toLong());
mp.put("list_price",ifnull(eachProd.get("list_price"),"0.0").toDecimal());
mp.put("discount",ifnull(eachProd.get("discount"),"0.0").toDecimal());
mp.put("wholesale_price",ifnull(eachProd.get("wholesale_price_1"),"0.0").toDecimal());
mp.put("maker_price",ifnull(eachProd.get("euro_Price"),"0.0").toDecimal());
mp.put("total",ifnull(eachProd.get("total"),"0.0").toDecimal());
mp.put("net_total",ifnull(eachProd.get("net_total"),"0.0").toDecimal());
pdlist.add(mp);
}
paramap = Map();
paramap.put("Product_Details",pdlist);
paramap.put("Subject",ifnull(respMap.get("Subject"),""));
contact = respMap.get("Contact_Name");
if(contact != null)
{
paramap.put("Contact_Name",contact.get("id"));
}
paramap.put("Terms_and_Conditions",ifnull(respMap.get("Terms_and_Conditions"),""));
paramap.put("Description",ifnull(respMap.get("Description"),""));
paramap.put("Adjustment",ifnull(respMap.get("Adjustment"),"0.0").toDecimal());
paramap.put("Discount",ifnull(respMap.get("Discount"),"0.0").toDecimal());
paramap.put("Maker Price",ifnull(respMap.get("maker_price"),"0.0").toDecimal());
paramap.put("Wholesale Price",ifnull(respMap.get("wholesale_price"),"0.0").toDecimal());
createResp = zoho.crm.createRecord("Purchase_Orders",paramap);
info createResp;
return "Sales order successully converted to Purchase Order";
}
    • Recent Topics

    • When Does WorkDrive integrate with Books?

      When Does WorkDrive integrate with Books?
    • CRM gets location smart with the all new Map View: visualize records, locate records within any radius, and more

      Hello all, We've introduced a new way to work with location data in Zoho CRM: the Map View. Instead of scrolling through endless lists, your records now appear as pins on a map. Built on top of the all-new address field and powered by Mappls (MapMyIndia),
    • Can we add zoho sign to a custom module?

      i understand out of the box it works with 8 modules. is it possible to add it to a custom module?
    • Synching changes to Stripe when changes are made in Zoho Billing

      We have a situation where we have merged customers in Zoho BIlling and then found out later that the payment in Stripe was not updated and still associated with the old customer record. The card gets updated and billed, but that payment is still associated
    • Zoho Sign Not Delivering

      I have sent several contracts out via Zoho Sign.   They do not seem to be getting delivered.  I had one person receive it, but the others have not.   I had one person tell me they sent it back to me and never got it and doesn't show as signed.  I've sent
    • Update latitude & longitude address field API

      How do I update the coordinates of an address field from a widget? I can't modify the latitude and longitude of the address field. I think the problem is how I'm writing formdata variable. zoho_init.then(function (data) { var queryParams = ZOHO.CREATOR.UTIL.getQueryParams();
    • Bank Feeds Breaking Constantly

      Hey Everyone, I have already reached out to support about this issue but I am wondering if anyone else is having the same issue. My bank feeds keep breaking within days of me fixing them by updating the credentials. Its been happening for a while and
    • Automatic Matching from Bank Statements / Feeds

      Is it possible to have transactions from a feed or bank statement automatically match when certain criteria are met? My use case, which is pretty broadly applicable, is e-commerce transactions for merchant services accounts (clearing accounts). In these
    • On Edit Validation Blueprint

      Hello, I have a notes field and a signature field. When the Approve button is clicked, the Signature field will appear and must be filled in. When the Reject button is clicked, the Notes field will appear and must be filled in. Question: Blueprint will
    • Zoho Payroll's USA and KSA editions are available in Zoho One!

      Greetings! We’re excited to share that Zoho Payroll, currently available only in India and the UAE, is now introducing the KSA (Kingdom of Saudi Arabia) edition and the USA (United States of America) edition, and these editions are now available in Zoho
    • Outlook/Hotmail Blocking Zoho SMTP IPs (S3150)

      We are currently facing a serious deliverability issue with Zoho SMTP while sending transactional OTP emails for our production application. Emails sent to Outlook / Hotmail addresses are being rejected with the following error: 550 - 5.7.1 Unfortunately,
    • Tip #63- Exploring Technician Console: Elevate to Admin Mode (Windows & Mac)- 'Insider Insights'

      Hello Zoho Assist Community! Ever been in a remote support session where you couldn’t complete a task because you didn’t have admin privileges? Maybe installing software, accessing secure system areas, or rebooting into Safe Mode just didn’t work because
    • Prevent accidental duplicate entry of Customer Ordersome

      Zoho Support has confirmed that Zoho currently does not have any method (using Deluge, flow or any other method) to alert a user when a sales order has been entered twice using the same customer reference number (i.e. a duplicate). Most ERP platforms
    • Zoho Mail - Email Reminder template (default)

      Zoho Mail Users, Does anybody here use the email reminder template? I'm asking Zoho to allow and add us to select which one of our many templates will be our default. It allows us to operate more efficiently. It's a Checkbox. If you feel this can benefit
    • Windows Desktop App - request to add minimization/startup options

      Support Team, Can you submit the following request to your development team? Here is what would be optimal in my opinion from UX perspective: 1) In the "Application Menu", add a menu item to Exit the app, as well as an alt-key shortcut for these menus
    • Zoho CRM Quotes – Subform and PDF/Writer Limitations

      Hello, I am encountering the following limitations in Zoho CRM Quotes: Custom product images cannot be uploaded in the subform – the image upload field cannot be added; only the file upload field is available. File upload placeholders cannot be used in
    • Canva Integration

      Hello! As many marketing departments are streamlining their teams, many have begun utilizing Canva for all design mockups and approvals prior to its integration into Marketing automation software. While Zoho Social has this integration already accomplished,
    • Announcement integration between Zoho People and Zoho Connect

      As we're using these 2 products, there're areas of overlapping especially in the Announcement. When there's a new announcement in Zoho People, can it push to the company wall in Zoho Connect?
    • Does Zoho Mail Have Popout windows?

      I recently switched my work email over to Zoho and everything I read said that you can popout the draft email as you're writing, however, all the pictures or info I've seen show the typical popout arrow in the top right, which I can not for the life of
    • Can I reorder how the staff are displayed on the booking page?

      As the title suggests, can I change this? Either reorder manually reoreded to my preference, or automatically (a-z, z-a etc.)
    • FSM integration with Books

      Hi, I have spent a few months working with FSM and have come across a critical gap in the functionality, which I find almost shocking....either that, or I am an idiot. The lack of bi-directional sync between Books and FSM on Sales Orders/ Work Orders
    • Bulk upload image option in Zoho Commerce

      I dont know if I am not looking into it properly but is there no option to bulk upload images along with the products? Like after you upload the products, I will have to upload images one by one again? Can someone help me out here? And what should I enter
    • Enhancement to ICR’s field prompting: Preferred data extraction using advanced field prompting

      Dear Customers, We hope you’re well A quick background Intelligent Character Recognition (ICR) comes as part of Zia’s optical recognition capability called Zia Vision. When we introduced it last April, the data extraction was training-based and was applicable
    • Filter Records in CRM API

      Hi Team, I’m currently working on a task to retrieve expired deals from the CRM. By “expired deals,” I mean deals where the closing date has already passed and the stage is not “Closed Won” or “Closed Lost” (i.e., all other stages). I tried using both
    • Subheaders for Sections in forms

      Currently, every form section has a field name, which one can choose to show/hide to the end user. It would be great if there was an option to show a SUB-HEADER in addition to a header. It would be useful for explaining to the end user what the section
    • Custom view inconsistencies

      Why is "is not" missing from criteria, along with other comparison operators ??? It makes it almost impossible to build required custom views, I don't want "void" invoices listed & why on earth would "Void" invoices be showing when the criteria includes
    • CRM x WorkDrive: We're rolling out the WorkDrive-powered file storage experience for existing users

      Release plan: Gradual rollout to customers without file storage add-ons, in this order: 1. Standalone CRM 2. CRM Plus and Zoho One DCs: All | Editions: All Available now for: - Standalone CRM accounts in Free and Standard editions without file storage
    • Promote a layout to standard so I can delete one layout

      Similar to this and many other topics: https://help.zoho.com/portal/en/community/topic/set-layout-as-standard The problem, every model has a standard layout, which is what we use most of the time... But as the business grows and evolves we may have to
    • Adding VENDOR SKU to PURCHASE ORDERS

      how can we add the Vendor SKU when issuing a Purchase Order , so the PO shows the Supplier SKU and our own Internal SKU , which is what we want to receive into the system .
    • Can Zia summarize fields?

      A great use case of AI for me would be summarizing company descriptions. We often get long winded descriptions from databases or scraping websites, then reduce them to a couple of sentences stating what a company actually does. Is there any way within
    • Zoho Recruit Community Meet-up - India (Venues Finalised)

      Zoho Recruit Community Meet-up - India (Venues Finalised) Namaste, India. 🙏🏼 The Zoho Recruit team is hitting the road—and we're absolutely excited behind the scenes. Join us for the Zoho Recruit India Meet-up 2026, a morning designed to make your recruiting
    • Increase Round Robin Scheduler Frequency in Zoho Desk

      Dear Zoho Desk Team, We hope this message finds you well. We would like to request an enhancement to the Round Robin Scheduler in Zoho Desk to better address ticket assignment efficiency. Current Behavior At present, the Round Robin Scheduler operates
    • [Webinar] Solving business challenges: Secure, real-time, and external collaboration

      Hi Zoho Writer users, We are excited to announce Zoho Writer's webinar for March 2026: Solving business challenges: Secure, real-time, and external collaboration. Zoho Writer supports real-time collaboration by allowing teams to work together in documents.
    • Table dimensions

      I try changing the dimensions of the table on my computer but it doesn't change. Do I have to be a premium member or does it only work on the app?
    • Zoho CRM Community Digest - January 2026 | Part 2

      Hello Everyone! Here’s the second part of January’s Zoho CRM Community Digest, rounding up the remaining highlights from the month. From newly rolled out updates to thoughtful implementation questions and practical solutions, the community once again
    • Find and Merge Duplicates to trigger webhook

      My sales team uses the Find and Merge Duplicates feature often to cleanup records in the CRM. We use webhooks to signal to our internal tools database when new Contacts are created, updated, or deleted, in order to keep our DB in sync with Zoho CRM. However,
    • Introducing WhatsApp integration and quick editing capabilities in Zoho Sign

      Hi there, Zoho Sign already helps users collect signatures via email and SMS, and we're happy to announce that you can now send documents and authenticate recipients right through WhatsApp. Some of the key benefits include: Communication with recipients
    • Dynamic Field Folders in OneDrive

      Hi, With the 2 options today we have either a Dynamic Parent Folder and lots of attachments all in that one folder with only the ability to set the file name (Which is also not incremented so if I upload 5 photos to one field they are all named the same
    • Logging Out of FSM

      I have tried to log out of FSM app of the last person and it will not let me do so. I need to log in to my account.
    • Manage Every Customer Conversation from Every Channel inside Zoho SalesIQ

      Your customers message you from everywhere. But are you really able to track, manage, and follow through on every conversation, without missing anything? With interactions coming in from websites, mobile apps, and messaging platforms like WhatsApp and
    • Next Page