Kaizen #144 - Assigning values to different field types using Zoho CRM SDKs - Part II

Kaizen #144 - Assigning values to different field types using Zoho CRM SDKs - Part II



Welcome to another week of our Kaizen series! 

In our last week's Kaizen post, we explored the various field types in Zoho CRM and their typical uses. We also discussed the utility of our SDK sample codes available in our GitHub repositories and how they can be tailored to meet your specific needs. For effective implementation, understanding how to assign values to these different field types using the SDK is crucial, which remains our primary focus in this series.

Last week, we covered this topic using our JAVA SDK. This week, we will discuss assigning values using PHP SDK. To make sure you are all caught up, please revisit Part I before proceeding further.

2. PHP SDK

For more details, please refer to the GitHub repository for our latest PHP SDK. Check out the sample codes here.

Standard Fields:

a. Import the Field Class:
  1. use com\zoho\crm\api\record\{module_api_name};
b. Assign Values to Standard Fields: The syntax for assigning values to standard fields uses the addFieldValue method of the Record object:
  1. $record->addFieldValue({module_api_name}::{field_api_name}(), value);
Replace {module_api_name} and {field_api_name} with the appropriate values for your specific use case. 

Assigning values to Standard Fields:

Field Type
JSON Type
Assign Values Assign Null Value
text (single line)
string 
$record->addFieldValue(Leads::LastName(), "Boyle"); $record->addFieldValue(Leads::LastName(), null);
textarea (multiline)
string
$record->addFieldValue(Leads::Description(), "Specify your description") $record->addFieldValue(Leads::Description(), null);
email
string
$record->addFieldValue(Leads::Email(), "abc@zoho.com"); $record->addFieldValue(Leads::Email(), null);
phone
string
$record->addFieldValue(Leads::Phone(), "91(987)654321"); $record->addFieldValue(Leads::Phone(), null);
picklist
string
$record->addFieldValue(Leads::LeadStatus(), new Choice("Not Contacted")); --
date
string
$record->addFieldValue(Products::Sales_Start_Date(), new DateTime(2024, 6, 13).Date); $record->addFieldValue(Products::Sales_Start_Date(), null);
integer (number)
integer
$record->addFieldValue(Accounts::Employees(), 100); $record->addFieldValue(Accounts::Employees(), 100);
currency (double)
double
$record->addFieldValue(Leads::AnnualRevenue(), 10.00); $record->addFieldValue(Leads::AnnualRevenue(), null);
boolean (checkbox) boolean $record->addFieldValue(Leads::EmailOptOut(), true); --
website (URL)
string
$record->addFieldValue(Leads::Website(), "https://www.zoho.com"); $record->addFieldValue(Leads::Website(), null);

Custom Fields:

To manage custom fields using PHP SDK: a. Import the Record Class:
  1. use com\zoho\crm\api\record\Record;
  2. $record = new Record();
b. Assign Values to Custom Fields: The syntax for assigning values to standard fields uses the AddKeyValue method of the Record object:
  1. $record->addKeyValue("{field_api_name}", value);
Replace {field_api_name} with the appropriate values for your specific use case. 

Assigning values to Custom Fields:

Field Type
JSON Type
Assign Value
Assign Null Value
text (single line)
string 
$record->addKeyValue("Single_Line_Field", "Text Single Line");
$record->addKeyValue("Single_Line_Field", null);
textarea (multiline)
string
$record->addKeyValue("Multi_Line_Field", "Text Multi Line");
$record->addKeyValue("Multi_Line_Field", null);
email
string
$record->addKeyValue("Email_Field", "abc@zoho.com");
$record->addKeyValue("Email_Field", null);
phone
string
$record->addKeyValue("Phone_Field", "9900000000");
$record->addKeyValue("Phone_Field", null);
picklist
string
$record->addKeyValue("Pick_List_Field", new Choice("Option 1"));
$record->addKeyValue("Pick_List_Field", null);
multiselectpicklist
JSON array
$record->addKeyValue("Multi_Select_Field", [new Choice("Option 1"), new Choice("Option 2")]);
$record->addKeyValue("Multi_Select_Field", null);
date
string
$record->addKeyValue("Date_Field", (new \DateTime('2024-06-13')));
$record->addKeyValue("Date_Field", null);
datetime
string
$record->addKeyValue("Date_Time_Field", date_create("2024-06-20T11:10:00+05:30")->setTimezone(new \DateTimeZone(date_default_timezone_get())));
$record->addKeyValue("Date_Time_Field", null);
integer (number)
integer
$record->addKeyValue("Number_Field", 12);
$record->addKeyValue("Number_Field", null);
currency (double)
double
$record->addKeyValue("Currency_Field", 10.25);
$record->addKeyValue("Currency_Field", null);
double
double
$record->addKeyValue("Decimal_Field", 12.25);
$record->addKeyValue("Decimal_Field", null);
percent 
double
$record->addKeyValue("Percent_Field", 12.25);
$record->addKeyValue("Percent_Field", null);
bigint (long integer)
string
$record->addKeyValue("Long_Integer_Field", "12345678");
$record->addKeyValue("Long_Integer_Field", null);
boolean (checkbox)
boolean
$record->addKeyValue("Checkbox_Field", true);
--
website (URL)
string
$record->addKeyValue("URL_Field", "https://www.zoho.com");
$record->addKeyValue("URL_Field", null);
lookup
JSON Object
$account = new Record();
$account->setId("3477061000023362051");
$record->addKeyValue("Lookup_Field", $account);
$record->addKeyValue("Lookup_Field", null);
multiselectlookup
JSON array
$record1 = new Record();
$linkingRecord = new Record();
$record1->addKeyValue("id", "3477061000023362051");
$linkingRecord->addKeyValue("Multi_Select_Lookup_Field", $record1);
$record->addKeyValue("Multi_Select_Lookup_Field", [$linkingRecord]);
$linkingRecord = new Record();
$linkingRecord->addKeyValue("_delete", true);
$linkingRecord->addKeyValue("id", "3477061000023557067");
$record->addKeyValue("Multi_Select_Lookup_Field", [$linkingRecord]);
userlookup
JSON object
$user = new MinifiedUser();
$user->setId("3477061000005791024");
$record->addKeyValue("User_Field", $user);
$record->addKeyValue("User_Field", null);
multiuserlookup
JSON array
$record1= new Record();
$linkingRecord = new MinifiedUser();
$linkingRecord->setId("3477061000005791024");
$record1->addKeyValue("MultiUser", $linkingRecord);
$record->addKeyValue("MultiUser", [$record1]);
$record1 = new Record();
$record1->addKeyValue("_delete", true);
$record1->setId("3477061000023553042");
$record->addKeyValue("MultiUser", [$record1]);
subform
JSON array
$subform = new Record();
$subform->addKeyValue("Name", "SDK");
$user1 = new MinifiedUser();
$user1->setId("3477061000018959001");
$subform->addKeyValue("User_Field", $user1);
$record->addKeyValue("Subform_Field", [$subform]);
$subform = new Record();
$subform->addKeyValue("_delete", true);
$subform->setId("3477061000023557086");
$record->addKeyValue("Subform_Field", [$subform]);
imageupload
JSON array
$imageUpload = new ImageUpload();
$imageUpload->setFileIdS("138ef2d9af5");
$record->addKeyValue("Image_Upload", [$imageUpload]);
$imageUpload = new ImageUpload();
$imageUpload->setDelete(null);
$imageUpload->setId("3477061000023579023");
$record->addKeyValue("Image_Upload", [$imageUpload]);
fileupload
JSON array
$fileDetail1 = new FileDetails();
$fileDetail1->setFileIdS("54957bcbc8fa685");
$record->addKeyValue("File_Upload", [$fileDetail1]);
$fileDetail1 = new FileDetails();
$fileDetail1->setDelete(null);
$fileDetail1->setId("3477061000023551042");
$record->addKeyValue("File_Upload", [$fileDetail1]);
multi_module_lookup
JSON Object
$record1 = new Record();
$record1->setId("3477061000021552002");
$module = array();
$module["id"] = "3477061000000002179";
$module["api_name"] = "Contacts";
$record1->addKeyValue("module", $module);
$record->addKeyValue("Appointment_For", $record1);
--


We trust this post has given you a better understanding of managing field data types in Zoho CRM using our PHP SDK. Remember that this learning does not end here. We have more posts coming up where we will explore handling field data types with our remaining SDK offerings. And do not forget to check out our Github for code samples.

As we strive for continuous improvement, we would love to hear your feedback. What topics would you like to see covered in our Kaizen series? Let us know in the comments or reach out to our support team at support@zohocrm.com.

Thank you for joining us this week. Happy coding and until next time!

Recommended Reads:




    Access your files securely from anywhere







                            Zoho Developer Community




                                                  • Desk Community Learning Series


                                                  • Digest


                                                  • Functions


                                                  • Meetups


                                                  • Kbase


                                                  • Resources


                                                  • Glossary


                                                  • Desk Marketplace


                                                  • MVP Corner


                                                  • Word of the Day


                                                  • Ask the Experts



                                                            • Sticky Posts

                                                            • Kaizen #226: Using ZRC in Client Script

                                                              Hello everyone! Welcome to another week of Kaizen. In today's post, lets see what is ZRC (Zoho Request Client) and how we can use ZRC methods in Client Script to get inputs from a Salesperson and update the Lead status with a single button click. In this
                                                            • Kaizen #222 - Client Script Support for Notes Related List

                                                              Hello everyone! Welcome to another week of Kaizen. The final Kaizen post of the year 2025 is here! With the new Client Script support for the Notes Related List, you can validate, enrich, and manage notes across modules. In this post, we’ll explore how
                                                            • Kaizen #217 - Actions APIs : Tasks

                                                              Welcome to another week of Kaizen! In last week's post we discussed Email Notifications APIs which act as the link between your Workflow automations and you. We have discussed how Zylker Cloud Services uses Email Notifications API in their custom dashboard.
                                                            • Kaizen #216 - Actions APIs : Email Notifications

                                                              Welcome to another week of Kaizen! For the last three weeks, we have been discussing Zylker's workflows. We successfully updated a dormant workflow, built a new one from the ground up and more. But our work is not finished—these automated processes are
                                                            • Kaizen #152 - Client Script Support for the new Canvas Record Forms

                                                              Hello everyone! Have you ever wanted to trigger actions on click of a canvas button, icon, or text mandatory forms in Create/Edit and Clone Pages? Have you ever wanted to control how elements behave on the new Canvas Record Forms? This can be achieved


                                                            Manage your brands on social media



                                                                  Zoho TeamInbox Resources



                                                                      Zoho CRM Plus Resources

                                                                        Zoho Books Resources


                                                                          Zoho Subscriptions Resources

                                                                            Zoho Projects Resources


                                                                              Zoho Sprints Resources


                                                                                Qntrl Resources


                                                                                  Zoho Creator Resources



                                                                                      Zoho CRM Resources

                                                                                      • CRM Community Learning Series

                                                                                        CRM Community Learning Series


                                                                                      • Kaizen

                                                                                        Kaizen

                                                                                      • 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


                                                                                            Zoho Show Resources

                                                                                              Zoho Writer

                                                                                              Get Started. Write Away!

                                                                                              Writer is a powerful online word processor, designed for collaborative work.

                                                                                                Zoho CRM コンテンツ



                                                                                                  Nederlandse Hulpbronnen


                                                                                                      ご検討中の方




                                                                                                              • Recent Topics

                                                                                                              • sync views to sheet

                                                                                                                Im looking to sync my views aka reports in analytics to zoho sheets, when data is updated in analytics it also should be updated in sheets, till now zoho sheets only offer raw data connection and it is not enough as these reports are difficult to re-do
                                                                                                              • How to update the Status in a custom module?

                                                                                                                Hi, I have a custom module "cm_payment_registry" in Billing, I am trying to change the status which is "Draft" with: array = {"custom_status":"Approved"}; zoho.billing.update("cm_payment_registry",organization.get("organization_id"), XXXXXXXXXXXXXX, array,"connectionname");
                                                                                                              • Opening balances - Accounts Receivable and Payable

                                                                                                                Our accounting year starts on 1st August 2013 and I have a Trial Balance as at that date, including Accounts Receivableand Accounts Payable balances, broken down by each customer and supplier. Q1 - do I show my opening balance date as 31st July 2013 or
                                                                                                              • Replace Zoho Invoice with QuickBooks

                                                                                                                We are implementing Zoho FSM for a cleaning business in the US with 50+ field workers. This business has been using Quickbooks for accounting for decades and will not migrate to Zoho Books. A major issue in the integration is the US sales tax calculation.
                                                                                                              • 2025 Highlights: A Year of Steady Progress and Significant Developments

                                                                                                                As we come to the end of 2025, let's take a moment to reflect on the significant progress and developments we've made to improve your travel and expense management. In the Spotlight Introducing Online Booking (US edition only - Early access) Enable online
                                                                                                              • Function #42: Show the actual rate of items on invoices

                                                                                                                Hello everyone, and welcome back to our series! In Zoho Books, you have the ability to create Price Lists, wherein you can mark up and mark down the item rates by a specific percentage or set custom rates. Generally, when you apply a price list to an
                                                                                                              • Ability to Set Text Direction for Individual Cells in Zoho Sheet

                                                                                                                Dear Zoho Sheet Team, We hope you are doing well. We would like to request an enhancement in Zoho Sheet that allows users to set the text direction (right-to-left or left-to-right) for individual cells, similar to what is available in Google Sheets. Use
                                                                                                              • Warehouse fast processing

                                                                                                                Hey guys, would anyone be interested in something like the attached image ? If there's any interest I'd be willing to develop it further for others to use, it's much faster than using Zohos native solutions, it can part pack, pack in full, part ship,
                                                                                                              • Can I create a CODE 128 custom field for my items in Zoho Inventory and then use it for generating Sales Orders?

                                                                                                                Can anyone helps me, I don't want to use the SKU code for scanning my products.  ​Because all my products have a CODE-128 label attached.
                                                                                                              • Start/Stop Timmer in Chrome Extension

                                                                                                                The chrome extension is great and allows you to do allot however one of the most common things employees working on projects need to do is track their time. Having an easy start/stop timer to track time would be great.
                                                                                                              • Invalid collection string

                                                                                                                I haven't changed anything in one of my functions. I'm trying to run it manually and suddenly "Invalid collection string" appears. My code has 6 lines and the error says that the error is on 7th line. Why? What does this error mean? Nothing has been changed
                                                                                                              • Zoho Directory 2025: New Features | Security Enhancements | Enriched UI

                                                                                                                Hello everyone, Greetings from the Zoho Directory team! 2025 has been a highly successful year for Zoho Directory. We are delighted to introduce a fresh set of features, an enriched UI, and major product enhancements. These updates aim to deliver a smoother
                                                                                                              • zoho people 5 report

                                                                                                                How do I customize my report in Zoho People Report? I understand that I can get the results of multi-table queries through SQL join statements, but I don't know the relationship between each table. I tried to create a report using Attendance User Report
                                                                                                              • Leave Report Emailed Weekly

                                                                                                                I am wondering if someone knows how to have a report generated either weekly or monthly or both for department heads and ownership of upcoming employee leave. For instance, it would be nice to get an emailed report on Friday for the upcoming week of who
                                                                                                              • Zoho Flow Decision Continuing Despite Not Meeting Conditions

                                                                                                                I have a picklist field called Lead Status in the leads module, with the following lead Statuses: New Lead Attempted Contact - 1 Attempted Contact - 2 Attempted Contact - 3 Attempted Contact - 4 Attempted Contact - 5 Attempted Contact - 6 Attempted Contact
                                                                                                              • Tip #55- Accessibility Controls in Zoho Assist: Exploring Vision Settings- 'Insider Insights'

                                                                                                                As we approach the end of the year, it’s a good moment to reflect on how we can make our tools more inclusive and easier to use for everyone. Remote support often involves long hours in front of screens, varied lighting conditions, and users with different
                                                                                                              • Zoho Recruit Slow and Freezing on all screens

                                                                                                                We have had an issue with Zoho Recruit for weeks being extremely slow and at times freezing.  We have 100 mega internet, and I went into each computer and updated the virtual memory so there is more available.  Also restarted all computers daily.  Still having the issues.  Almost unable to work.
                                                                                                              • Credit Management: #2 Configuring Right Payment Terms for Credit Control

                                                                                                                Think about the last time you ordered something online and saw that little note at the checkout, "Pay on Delivery" or "Pay later". It's simple, but it actually sets the tone. As a business owner, you know exactly when payment is expected. Now, imagine
                                                                                                              • Dependent (Conditional) Fields in Zoho Bookings Forms

                                                                                                                Hello Zoho Bookings Team, Greetings, We would like to request the ability to create dependent (conditional) fields in Zoho Bookings registration forms. Current Limitation: There is currently no way to make one field’s available options depend on the value
                                                                                                              • Bug Report: Search fails to find existing notes after Evernote import

                                                                                                                Hello, I recently migrated from Evernote (~2600 notes across 23 notebooks), but the search functionality is currently broken. The Issue: I can manually browse to a specific note and see it exists. However, when I type the exact or partial title of that
                                                                                                              • Marketing Tip #13: Win repeat customers with post-purchase emails

                                                                                                                The relationship with your customer doesn’t end after the sale; that’s when it begins. A thoughtful post-purchase message shows customers you appreciate them, keeps your brand top of mind, and can even lead to another sale. You can thank them, ask for
                                                                                                              • Zoho Form

                                                                                                                I have problem with Zoho Form. One of form i don't received the PDF version. Others okay except this one. W904533
                                                                                                              • Create & Update Zoho Vault Passwords via Zoho Flow

                                                                                                                Hi Zoho Flow / Zoho Vault Team, We’d like to request an enhancement to the Zoho Vault integration in Zoho Flow. Current Limitation: At the moment, Zoho Flow supports only the following selected Zoho Vault actions, such as: Fetch passwords, Share passwords
                                                                                                              • Custom Related List Inside Zoho Books

                                                                                                                Hello, We can create the Related list inside the zoho books by the deluge code, I am sharing the reference code Please have a look may be it will help you. //..........Get Org Details organizationID = organization.get("organization_id"); Recordid = cm_g_a_data.get("module_record_id");
                                                                                                              • Migrate different zoho subscription to zoho one

                                                                                                                Dear We have different zoho subscription we need to migrate it to zoho one. Currently we are paying for zoho email, zoho expense, zoho payroll etc under different admin We need to move it too zoho one flexlible plan for all my employees
                                                                                                              • Features, Feedback and Votes

                                                                                                                We’re launching the Feedback Forum for our customers. This is 'THE' place where you can add everything you’d like to see in Zoho Books. If you don't find the specific feature you need, simply add it so others can also vote for it. While we cannot promise
                                                                                                              • Payment system for donations management

                                                                                                                I manage an organization where we receive donations from payers. Hence, there is no need to first create invoices and then create payments received against the invoices. What are the recommended best practices to do this in ZohoBooks?
                                                                                                              • There Might Be A Glitch in Determining If A String Represents A URL

                                                                                                                I suspect there might be a glitch in determining if a string represents a URL or not. For example, I cannot embed the following URL. Perhaps the exclamation mark or parentheses are the culprit? https://en.wikipedia.org/wiki/How_the_Grinch_Stole_Chri
                                                                                                              • Customer Management: #4 Enhance Customer Journey

                                                                                                                When Neha started DefineOps, a growing IT support and consulting firm, most of her work was straightforward. A client would sign up for a free version, decide whether the service works for them, and then either continue or discontinue. Billing was simple,
                                                                                                              • Android app sync problem - multiple devices have same problem

                                                                                                                Hello, I am having a problem with synchronization in the Android app. When I create a drawing, the data does not sync correctly—only a blank note is created without the drawing. I tested this on multiple devices, including phones and tablets, and the
                                                                                                              • Marketing Tip #1: Optimize item titles for SEO

                                                                                                                Your item title is the first thing both Google and shoppers notice. Instead of a generic “Leather Bag,” go for something detailed like “Handcrafted Leather Laptop Bag – Durable & Stylish.” This helps your items rank better in search results and instantly
                                                                                                              • Territory Assignment Issues (Lead to Account + Contact)

                                                                                                                1. Lead → Account & Contact Territory Assignment on Conversion A Lead is automatically assigned one or more territories using a workflow and Lead Assignment Rules. This works as expected, and we are able to assign multiple territories to a Lead automatically.
                                                                                                              • Marketer's Space: Proven tips to improve open rates – Part II

                                                                                                                Hello Marketers! Welcome back to another post in Marketer's Space! We're continuing from where we left off a fortnight ago. We ended the previous post discussing the subject line, and we'll continue from there. Let's dive right in. Pre-header Pre-header
                                                                                                              • SQL Table slowed to a crawl

                                                                                                                Hi all - I seem to have noticed an update. Now whenever I am typing in the script field for the SQL tables there is a huge delay and it is all very slow. This has never been the case for me in over 5 years of using Analytics - I really hope it's fixed
                                                                                                              • Deluge Events/search API works in user environment but not in sandbox – why?

                                                                                                                I am creating an Extension for Zoho CRM using Zoho Sigma Platform I’m using the following Deluge code to search Events in Zoho CRM based on Start_DateTime: criteria = "(Start_DateTime:greater_than:2025-12-20T00:00:00+00:00)"; url = "crm/v8/Events/search?criteria="
                                                                                                              • Ensure Consistent Service Delivery with Comprehensive Job Sheets

                                                                                                                We are elated to announce that one of the most requested features is now live: Job Sheets. They are customizable, reusable forms that serve as a checklist for the services that technicians need to carry out and as a tool for data collection. While on
                                                                                                              • What are Zoho Meeting capabilities included in Zoho Workplace Standard?

                                                                                                                I am evaluating using Zoho Meeting for my organization, but it is not clear what Zoho Meeting capabilities are already included in Zoho Workplace Standard. - Are meeting recordings included in Workplace Standard? - Can we invite external meeting participants
                                                                                                              • How can I get the participant list of a reoccurring meeting afterwards?

                                                                                                                I'm trying to use the Meeting Participant Report from the API docs but when I call it on a reoccurring meeting it returns that there are no participants because it thinks I'm talking about the meeting in the future. Is there a way to use webhooks or some
                                                                                                              • Function #50: Send Mass emails to your customers

                                                                                                                Hello everyone, and welcome back to our series! We have reached a milestone of 50 Functions, which means that we have automated 50 different tasks in Zoho Books. Every Friday, we have shared a nifty function aimed at either automating a task or streamlining
                                                                                                              • Full Hebrew Language Support for Client-Side Zoho Assist Interface

                                                                                                                Dear Zoho Assist Team, We would like to request an enhancement to Zoho Assist's client-side interface to support full Hebrew language customization, including all popups, notifications, and session-related messages. Current Limitation The Join page allows
                                                                                                              • Next Page