Unable to create custom function - Please check the screenshot for the details
HERE IS THE FUNCTION!!
try
{
// 1. Fetch the details of the approved Bill using its ID
billDetails = zoho.books.getRecordById("Bills", organization.get("organization_id"), billId);
// Check if bill details were successfully fetched and if it contains line items
if (billDetails.get("code") == 0 && billDetails.get("bill") != null && billDetails.get("bill").get("line_items") != null)
{
lineItems = billDetails.get("bill").get("line_items");
// 2. Iterate through each line item in the Bill
for each lineItem in lineItems
{
itemID = lineItem.get("item_id");
itemRate = lineItem.get("rate"); // This is the purchase rate for the item on this specific bill line
itemType = lineItem.get("item_type"); // To ensure we only update 'goods' (inventory) items
// Ensure itemID and itemRate are valid and it's an inventory item ("goods")
if (itemID != null && itemRate != null && itemRate > 0 && itemType == "goods")
{
// 3. Prepare a map with the new purchase_price for the item
itemUpdateMap = Map();
// 'purchase_price' is the API field name for the 'Cost Price' field in the Zoho Books UI
itemUpdateMap.put("purchase_price", itemRate);
// 4. Update the item's master record using the Zoho Books API
updateResponse = zoho.books.updateRecord("Items", organization.get("organization_id"), itemID, itemUpdateMap);
// Check if the update was successful
if (updateResponse.get("code") == 0)
{
info "Successfully updated Purchase Price for Item ID " + itemID + " to " + itemRate + ".";
}
else
{
errorMessage = "Failed to update Purchase Price for Item ID " + itemID + ": " + updateResponse.get("message");
// error errorMessage;
}
}
else if (itemType != "goods")
{
info "Skipping non-goods item (ID: " + itemID + ", Type: " + itemType + ") from Bill ID " + billId;
}
else
{
info "Skipping line item with invalid itemID or rate (ID: " + itemID + ", Rate: " + itemRate + ") from Bill ID " + billId;
}
}
}
else
{
info "No line items found or bill details could not be fetched for Bill ID: " + billId;
}
}
catch (e)
{
//error "An error occurred in updateItemPurchasePriceOnBillApproval function for Bill ID " + billId + ": " + e;
}
Recent Topics
LESS_THAN_MIN_OCCURANCE - code 2945
Hi I'm trying to post a customer record to creator API and getting this error message. So cryptic. Can someone please help? Thanks Varun
Ranking by group in report
Dears, I am new to Zoho Analytics and I would like to ask you guys help to creating a ranking column. Report type: Pivot Matter: I want to create a ranking column on the right of Percentage. This ranking is group by column Type, and ranking by Final Score/Percent.
How do I add a project template to a pre-existing project?
Help....How do I add a project template to a pre-existing project? Right now I have to delete the old project, make a new one and add the project template at the time of creating the new project.
How to add line breaks in zoho.cliq.postToUser(...) message?
In a CRM function using Deluge I'm sending this message and attempting to add some line breaks but they are ignored. Is there another way to add these breaks? My message: message: New urgent task\nDescription \nThis is a fake description.\n A new line?
Passing the image/file uploaded in form to openai api
I'm trying to use the OpenAI's new vision feature where we can send image through Api. What I want is the user to upload an image in the form and send this image to OpenAI. But I can't access this image properly in deluge script. There are also some constraints
Users may not pick the fields to be shown as columns in the Choose Account window when creating a new Deal record
Hi there, by talking with other users I found out that I, as an Admin, am the only one who can pick fields to be shown as columns in the Choose Account window when creating a new Deal record. In fact, if other users click on the "Add Column" symbol on
{Action Required} Re-authenticate your Google Accounts to Continue Data Sync
Hello Users! To align with Google’s latest updates on how apps access files in Google Drive, we’ve enhanced our integration to comply with the updated security and privacy standards, ensuring safer and more reliable access to your data. With this update,
Why is the ability Customize Calls module so limited?
Why can't I add additional sections? why can't I add other field types than the very limited subset that zoho allows? Why can I only add fields to the outbound/inbound call sections and not to the Call Information section?
Report Template - How to remove page break after each record?
Hi, We have report template for a list report. It looks good at screen. But when printing, it creates a page break after each record. How to remove the it? So we can print multiple records in same page. Please look at the attached screenshots. Report Template Report Print Preview
Calendar report with order options and more quick view templates
I think many of us regularly work with calendar-style reports. It would be great to be able to customize the quick view with new templates and have options to sort the entries for each day of the calendar by different criteria. I think this is an interesting
Sender Email Configuration Error.
Hello Team, Hope you are all doing well. We are in the process of creating the Zoho FSM environment in the UAE. When we try to add the sender email address “techsupportuae@stryker.com”, we receive the error message: “Error occurred while sending mail
Not receiving New Ticket Emails
Hello! The company I work for uses the Zoho ticketing system, however, I've noticed I'm not receiving email notifications when new tickets are published. I have admin rights to see these tickets on Zoho Desk and respond to them, but am not receiving the
Career site URL - Suggestion to modify URL of non-english job posting
Hi, I would like to suggest making a few modification to career sites that are not in english. Currently, the URL are a mix of different languages and are very long. It makes for very unprofessional looking URLs... Here is an example of one of our URL
CRM notes
I want to be able to add notes to a task that do not necessarily get rolled up into an account or contact. For example, I tasks to work on a Court Order for John Doe divorce account. There might be lots of updates (in the form of notes) that employees
Confluence export to zoho learn
Hello Is there any known way to export Confluence spaces to zoho learn ?
Zoho People API, Inactive users
Hi, I would like to export using the Zoho People API using Fetch Leave Records API V2 | Zoho People API. However it only pulls active user's leaves. I want all users, active and former employees records.
Unified Notes View For Seamless Collaboration
To facilitate better coordination among different departments and team members, the notes added to a record can now be accessed in all its associated records. With this, team members, from customer service representatives to field technicians, can easily
Empty folders are now appearing in the sidebar...
...and the folder list is now auto-collapsed by default with no way to change. Neither of these recent updates are useful or user-friendly. ==================== Powered by Haiku https://www.haiku.co.uk ====================
Client Script | Update - Client Script Support For Custom Buttons
Hello everyone! We are excited to announce one of the most requested features - Client Script support for Custom Buttons. This enhancement lets you run custom logic on button actions, giving you greater flexibility and control over your user interactions.
Zoho CRM for Everyone's NextGen UI Gets an Upgrade
Hello Everyone We've made improvements to Zoho CRM for Everyone's Nextgen UI. These changes are the result of valuable feedback from you where we’ve focused on improving usability, providing wider screen space, and making navigation smoother so everything
Create custom rollup summary fields in Zoho CRM
Hello everyone, In Zoho CRM, rollup summary fields have been essential tools for summarizing data across related records and enabling users to gain quick insights without having to jump across modules. Previously, only predefined summary functions were
Monthly Webinar - Getting Started with Zoho LandingPage
Are you building your first landing page and want a little guidance? Join our monthly Getting Started with Zoho LandingPage webinar and learn how landing pages fit into your marketing strategy, drive lead generation, and improve conversions. Here’s what
View all email threads directly from record's History and Interactions
Greetings all, We've introduced the ability to view complete email thread conversations directly from records' History and Interactions sections, along with email delivery status and sentiment insights on the Interactions page—which makes it easier for
Marketing Tip #22: Check website and navigation for broken links
Do you inspect your online store frequently? If not, here's your reminder to do it now. Broken links frustrate customers and make your store feel unreliable. Whether it’s a missing product page, an outdated menu item, social media accounts, or a broken
Is there a way to show contact emails in the Account?
I know I can see the emails I have sent and received on a Contact detail view, but I want to be able to see all the emails that have been sent and received between all an Accounts Contacts on the Account Detail view. That way when I see the Account detail
All new Address Field in Zoho CRM: maintain structured and accurate address inputs
The address field will be available exclusively for IN DC users. We'll keep you updated on the DC-specific rollout soon. It's currently available for all new sign-ups and for existing Zoho CRM orgs which are in the Professional edition. Latest update
Custom function return type
Hi, How do I create a custom deluge function in Zoho CRM that returns a string? e.g. Setup->Workflow->Custom Functions->Configure->Write own During create or edit of the function I don't see a way to change the default 'void' to anything else. Adding
push notification to Cliq when user is @mentioned in CRM notes
push notification to Cliq when user is @mentioned in CRM notes. Currently users that is @mentioned gets an email to be notified. User/s that is @mentioned should get a Cliq notification.
How to make entries for restaurant sales in Zoho Books?
Hello, I'm new to Zoho Books. I need to understand how to record our restaurant sales in Zoho Books. We can't raise invoices for each bill from the daily sales report generated by our POS (duplicated effort). We need a means of entering cumulative sales
Creating Restaurant Inventory Management on Zoho
Hi, We run a small cloud kitchen and are interested to use Zoho for Inventory and Composite Item tracking for our food served and supplied procured to make food items. Our model is basically like subway where the customer can choose breads, veggies,
Allow Admin to Configure Report > More Options Button
As an Admin, I want to configure the options of the Report > More Options button to improve UX and reduce Developer overhead. See attached screenshot. Original question posted here: https://help.zoho.com/portal/en/community/topic/modify-standard-rep
Sending emails via Books
Anyone else getting similar problems recently ??..... Hi, Your message to the following recipient was not delivered. Please find the details below. Bounce Details: Bounced Address : someone@google.com Bounce Reason : other ; Status : 5.0.0 (undefined status) ; Daignostic-Code : smtp;542 someone@google.com Rejected ; Bounced Time : Sep 05, 2017 06:37 PM BST Regards, Zoho Team The email addresses were fine only a few days ago but are now being rejected ?
Integrate with WooCommerce using Wordpress Plugin
We’re thrilled to announce a powerful update to the Zoho Marketing Automation WordPress plugin with WooCommerce integration! This enhancement enables new possibilities for businesses running online stores using WooCommerce, empowering them to merge seamless
Workdrive on Android - Gallery Photo Backups
Hello, Is there any way of backing up the photos on my android phone directly to a specific folder on Workdrive? Assuming i have the workdrive app installed on the phone in question. Emma
Auto sync Photo storage
Hello I am new to Zoho Workdrive and was wondering if the is a way of automatically syncing photos on my Android phone to my workdrive as want to move away from Google? Thanks
Zoho Subscriptions -- Zoho Commerce integration
Is there integration between Zoho Subscriptions and Zoho Commerce? I would like to create subscription plans in Zoho Subscritpions and list them for on my Zoho Commerce store.
Need help with importing expenses
I'm using the template downloaded from the application. When I try to import my expenses, I get the message: Duplicate entry in the Expense Date column. Ensure it contains unique values. None of the rows will import. There are duplicate dates, but they
Create static subforms in Zoho CRM: streamline data entry with pre-defined values
Last modified on (9 July, 2025): This feature was available in early access and is currently being rolled out to customers in phases. Currently available for users in the the AU, CA, and SA DCs. It will be enabled for the remaining DCs in the next couple
Restoring records from the recycle bin programatically
Background I'm working on a piece of software to automate conversion of Leads into Deals based on order status from my company's website. The process is mostly complete, right now I'm just working on handling a few edge cases to ensure data integrity.
How can I clone my website in order to try new templates?
I want to try a new template for my existing Zoho website without the risk of changing the current site or accidentally publishing the wrong template. Therefore I thought a 'clone website'-option should be somewhere, but I can't find it. How do I try
Next Page