Welcome to another week of our Kaizen series! Today, we will discuss a critical aspect of working with Zoho CRM SDKs across various programming languages: assigning values to fields of different data types.
Zoho CRM offers a comprehensive suite of SDKs for PHP, Java, Node.js, C#, Python, Ruby, TypeScript, Scala, and JavaScript, streamlining development workflows across various programming languages. Today's discussion will provide you with the knowledge to handle various data types and their assignment across our different SDK languages. By the end, you will be well-equipped to utilize the sample codes in our GitHub repository and tailor them to your specific CRM needs.
In Zoho CRM modules, a variety of field types are available, enabling you to collect and manage a broad spectrum of customer data. Here's a quick reference summarizing the common data types:
import com.zoho.crm.api.record.Field; |
record.addFieldValue(Field.{module_api_name}.{FIELD_API_NAME},value); |
Field Type JSON Type | Assign Values | Assign Null Values |
text (single line) string | record.addFieldValue(Field.Leads.LAST_NAME, "Last Name"); | record.addFieldValue(Field.Leads.LAST_NAME, null); |
textarea (multiline) string | record.addFieldValue(Field.Leads.DESCRIPTION, "Last Name"); | record.addFieldValue(Field.Leads.DESCRIPTION, null); |
email string | record.addFieldValue(Field.Leads.EMAIL, " abc@zoho.com"); | record.addFieldValue(Field.Leads.EMAIL, null); |
phone string | record.addFieldValue(Field.Leads.PHONE, "91(987)654321"); | record.addFieldValue(Field.Leads.PHONE, null); |
picklist string | record.addFieldValue(Field.Leads.LEAD_STATUS, new Choice<String>("Not Contacted")); | -- |
date string | record.addFieldValue(Field.Products.SALES_START_DATE, LocalDate.of(2024, 6, 13)); | record.addFieldValue(Field.Products.SALES_START_DATE, null); |
integer (number) integer | record.addFieldValue(Field.Accounts.EMPLOYEES,100); | record.addFieldValue(Field.Accounts.EMPLOYEES,null); |
currency (double) double | record.addFieldValue(Field.Leads.ANNUAL_REVENUE, 10.00); | record.addFieldValue(Field.Leads.ANNUAL_REVENUE, null); |
boolean (checkbox) boolean | record.addFieldValue(Field.Leads.EMAIL_OPT_OUT, true); | -- |
website (URL) string | record.addFieldValue(Field.Leads.WEBSITE, " https://www.zoho.com"); | record.addFieldValue(Field.Leads.WEBSITE, null); |
multi_module_lookup JSON Object | com.zoho.crm.api.record.Record record1 = new com.zoho.crm.api.record.Record(); record1.setId(3477061000021552002l); HashMap<String, String> module = new HashMap<String, String>(); module.put("id", "3477061000000002179"); module.put("api_name", "Contacts"); record1.addKeyValue("module", module); record.addFieldValue(Field.Appointments__s.APPOINTMENT_FOR, record1); | -- |
com.zoho.crm.api.record.Record record = new com.zoho.crm.api.record.Record(); |
record.addKeyValue("{field_api_name}", value); |
Field Type JSON Type | Assign Values | Assign Null Values |
text (single line) string | record.addKeyValue("Single_Line_Field", "Single Line Text Value"); | record.addKeyValue("Single_Line_Field", null); |
textarea (multiline) string | record.addKeyValue("Multi_Line_Field", "Text Multi Line 2"); | 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<String>("Option 1")); | record.addKeyValue("Pick_List_Field", null); |
multiselectpicklist JSON array | record.addKeyValue("Multi_Select_Field", new ArrayList<>(Arrays.asList(new Choice<String>("Option 1"), new Choice<String>("Option 2")))); | record.addKeyValue("Multi_Select_Field", null); |
date string | record.addKeyValue("Date_Field", LocalDate.of(2024, 6, 13)); | record.addKeyValue("Date_Field", null); |
datetime string | record.addKeyValue("Date_Time_Field", OffsetDateTime.of(2024, 06, 20, 10, 00, 01, 00, ZoneOffset.of("+05:30"))); | 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", 12345678l); | 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", " https://www.zoho.com"); |
lookup JSON Object | com.zoho.crm.api.record.Record account = new com.zoho.crm.api.record.Record(); account.setId(3477061000023362051l); record1.addKeyValue("Lookup_Field", account); | -- |
multiselectlookup JSON Object | List<com.zoho.crm.api.record.Record> multirecords = new ArrayList<>(); com.zoho.crm.api.record.Record record1 = new com.zoho.crm.api.record.Record(); com.zoho.crm.api.record.Record linkingRecord = new com.zoho.crm.api.record.Record(); record1.addKeyValue("id", 3477061000023362051L); linkingRecord.addKeyValue("Multi_Select_Lookup_Field", record1); multirecords.add(linkingRecord); record.addKeyValue("Multi_Select_Lookup_Field", multirecords); | List<com.zoho.crm.api.record.Record> multirecords = new ArrayList<>(); com.zoho.crm.api.record.Record linkingRecord = new com.zoho.crm.api.record.Record(); linkingRecord.addKeyValue("_delete", true); linkingRecord.addKeyValue("id", 3477061000023479001l); multirecords.add(linkingRecord); record.addKeyValue("Multi_Select_Lookup_Field", multirecords); |
userlookup JSON object | com.zoho.crm.api.users.MinifiedUser user = new com.zoho.crm.api.users.MinifiedUser(); user.setId(3477061000005791024l); record.addKeyValue("User_Field", user); | record.addKeyValue("User_Field", null); |
multiuserlookup JSON array | List<com.zoho.crm.api.record.Record> multiuser = new ArrayList<>(); com.zoho.crm.api.record.Record record1 = new com.zoho.crm.api.record.Record(); com.zoho.crm.api.users.MinifiedUser linkingRecord = new com.zoho.crm.api.users.MinifiedUser(); linkingRecord.setId(3477061000005791024l); record1.addKeyValue("MultiUser", linkingRecord); multiuser.add(record1); record.addKeyValue("MultiUser", multiuser); | List<com.zoho.crm.api.record.Record> multiuser = new ArrayList<>(); com.zoho.crm.api.record.Record record1 = new com.zoho.crm.api.record.Record(); record1.addKeyValue("_delete", true); record1.setId(3477061000023490004l); multiuser.add(record1); record.addKeyValue("MultiUser", multiuser); |
subform JSON array | List<com.zoho.crm.api.record.Record> subformList = new ArrayList<com.zoho.crm.api.record.Record>(); com.zoho.crm.api.record.Record subform = new com.zoho.crm.api.record.Record(); subform.addKeyValue("Name", "SDK"); com.zoho.crm.api.users.MinifiedUser user1 = new com.zoho.crm.api.users.MinifiedUser(); user1.setId(3477061000018959001l); subform.addKeyValue("User_Field", user1); subformList.add(subform); record.addKeyValue("Subform_Field", subformList); | List<com.zoho.crm.api.record.Record> subformList = new ArrayList<com.zoho.crm.api.record.Record>(); com.zoho.crm.api.record.Record subform = new com.zoho.crm.api.record.Record(); subform.addKeyValue("_delete", true); subform.setId(3477061000023502001l); subformList.add(subform); record.addKeyValue("Subform_Field", subformList); |
imageupload JSON array | List<ImageUpload> imageUploads = new ArrayList<ImageUpload>(); ImageUpload imageUpload = new ImageUpload(); imageUpload.setFileIdS("18aed780ff77c8698406d1befdb1341435"); imageUploads.add(imageUpload); record.addKeyValue("Image_Upload", imageUploads); | List<ImageUpload> imageUploads = new ArrayList<ImageUpload>(); ImageUpload imageUpload = new ImageUpload(); imageUpload.setDelete(null); imageUpload.setId("3477061000023502009"); imageUploads.add(imageUpload); record.addKeyValue("Image_Upload", imageUploads); |
fileupload JSON array | List<FileDetails> fileDetails = new ArrayList<FileDetails>(); FileDetails fileDetail1 = new FileDetails(); fileDetail1.setFileIdS("ed69c3580d797bc"); fileDetails.add(fileDetail1); record.addKeyValue("File_Upload", fileDetails); | List<FileDetails> fileDetails = new ArrayList<FileDetails>(); FileDetails fileDetail1 = new FileDetails(); fileDetail1.setDelete(null); fileDetail1.setId("3477061000023499013"); fileDetails.add(fileDetail1); record.addKeyValue("File_Upload", fileDetails); |
multi_module_lookup JSON Object | com.zoho.crm.api.record.Record record1 = new com.zoho.crm.api.record.Record(); record1.setId(3477061000021552002l); HashMap<String, String> module = new HashMap<String, String>(); module.put("id", "3477061000000002179"); module.put("api_name", "Contacts"); record1.addKeyValue("module", module); record.addKeyValue("Appointment_For", record1); | -- |
Writer is a powerful online word processor, designed for collaborative work.