Skip to product menu
close
  • Recent Launches
    Press Space or Enter to display list of options
EXPLORE ALL PRODUCTS

Recent Launches

New

Payroll software with automated tax payments and filing.

Try now
New

Robotic process automation software to automate high-volume, rule-based tasks.

Try for free
New

Low-code IoT platform and solutions for connected businesses.

Try now
New

Business formation service to launch and grow your businesses.

Try now
New

Privacy-friendly application analytics solution.

Try for free
SuitesNew

Unified project management platform for intelligent, data-driven work.

Try now

Sales

 
CRM

Comprehensive CRM platform for customer-facing teams.

CRM
 
Bigin

Simple CRM for small businesses moving from spreadsheets.

Bigin
 
Forms

Build online forms for every business need.

Forms
 
SalesIQ

Live chat app to engage and convert website visitors.

SalesIQ
 
Bookings

Appointment scheduling app for consultations with customers.

Bookings
 
Sign

Digital signature app for businesses.

Sign
 
RouteIQ

Comprehensive sales map visualization and optimal route planning solution.

RouteIQ
 
Thrive

Complete loyalty and affiliate management platform.

Thrive
 
Voice

Cloud Contact Center Software for businesses.

Voice
 
Suites
CRM Plus

Unified platform to deliver top-notch customer experience.

CRM Plus

Marketing

 
Social

All-in-one social media management software.

Social
 
Campaigns

Create, send, and track targeted email campaigns that drive sales.

Campaigns
 
Forms

Build online forms for every business need.

Forms
 
Survey

Design surveys to reach and interact with your audience.

Survey
 
Sites

Online website builder with extensive customisation options.

Sites
 
PageSense

Website conversion optimization and personalisation platform.

PageSense
 
Backstage

End-to-end event management software.

Backstage
 
Webinar

Webinar platform for webcasting online webinars.

Webinar
 
Marketing Automation

All-in-one marketing automation software.

Marketing Automation
 
LandingPage

Smart landing page builder to increase conversion rates

LandingPage
 
Publish

Manage all your local business listings on a single platform.

Publish
 
SalesIQ

Live chat app to engage and convert website visitors.

SalesIQ
 
Sign

Digital signature app for businesses.

Sign
 
Thrive

Complete loyalty and affiliate management platform.

Thrive
 
Voice

Cloud Contact Center Software for businesses.

Voice
 
NEW
LeadChain

Sync, manage, and convert leads across channels seamlessly.

LeadChain
 
NEW
CommunitySpaces

Online community platform for individuals and businesses to grow their network and brand.

CommunitySpaces
 
Suites
Marketing Plus

Unified marketing platform for marketing teams.

Marketing Plus

Commerce

 
Commerce

eCommerce platform to manage and market your online store.

Commerce

Service

 
Desk

Helpdesk software to deliver great customer support.

Desk
 
Assist

Remote support and unattended remote access software.

Assist
 
Lens

Interactive remote assistance software with augmented reality.

Lens
 
FSM

End-to-end field service management platform for service businesses.

FSM
 
SalesIQ

Live chat app to engage and convert website visitors.

SalesIQ
 
Voice

Cloud Contact Center Software for businesses.

Voice
 
NEW
Solo

The all-in-one toolkit for solopreneurs.

Solo
 
Bookings

Appointment scheduling app for consultations with customers.

Bookings
 
Suites
Service Plus

Unified platform for customer service and support teams.

Service Plus

Finance

 
Books

Powerful accounting platform for growing businesses.

Books
 
FREE
Invoice

100% Free invoicing solution.

Invoice
 
Expense

Effortless expense reporting platform.

Expense
 
Inventory

Powerful stock management and inventory control software.

Inventory
 
Billing

End-to-end billing solution for your business.

Billing
 
Checkout

Collect payments online with custom branded pages.

Checkout
 
NEW
Payroll

Payroll software with automated tax payments and filing.

Payroll
 
NEW
Solo

The all-in-one toolkit for solopreneurs.

Solo
 
Practice

Practice management software for accounting firms.

Practice
 
Sign

Digital signature app for businesses.

Sign
 
Commerce

eCommerce platform to manage and market your online store.

Commerce
 
Suites
Finance Plus

All-in-one suite to manage your operations and finances.

Finance Plus

Email and Collaboration

 
Mail

Secure email service for teams of all sizes.

Mail
 
Meeting

Online meeting software for all your video conferencing & webinar needs.

Meeting
 
Writer

Word processor for focused writing and discussions.

Writer
 
Sheet

Spreadsheet software for collaborative teams.

Sheet
 
Show

Create, edit, and share slides with a sleek presentation app.

Show
 
Notebook

Beautiful home for all your notes.

Notebook
 
Cliq

Stay in touch with teams no matter where you are.

Cliq
 
Connect

Employee experience platform to communicate, engage, and build positive employee relations.

Connect
 
Bookings

Appointment scheduling app for consultations with customers.

Bookings
 
TeamInbox

Shared inboxes for teams.

TeamInbox
 
WorkDrive

Online file management for teams.

WorkDrive
 
Sign

Digital signature app for businesses.

Sign
 
Office Suite

Powerful collaborative work platform for teams.

Office Suite
 
Office Integrator

Built in document editors for web apps.

Office Integrator
 
ZeptoMail

Secure and reliable transactional email sending service.

ZeptoMail
 
Calendar

Online business calendar to manage events and schedule appointments.

Calendar
 
Learn

Knowledge and learning management platform.

Learn
 
Voice

Cloud Contact Center Software for businesses.

Voice
 
ToDo

Collaborative task management for individuals and teams.

ToDo
 
Tables

Work management tool to connect people, processes, and information.

Tables
 
FREE
PDF Editor

Collaborative online PDF editing tool.

PDF Editor
 
Suites
Workplace

Application suite built to improve team productivity and collaboration.

Workplace

Human Resources

 
People

Organize, automate, and simplify your HR processes.

People
 
Recruit

Intuitive recruiting platform built to provide hiring solutions.

Recruit
 
Expense

Effortless expense reporting platform.

Expense
 
Workerly

Manage temporary staffing with an employee scheduling solution.

Workerly
 
NEW
Payroll

Payroll software with automated tax payments and filing.

Payroll
 
Shifts

Employee scheduling and time tracking app.

Shifts
 
Sign

Digital signature app for businesses.

Sign
 
Suites
People Plus

Comprehensive HR platform for seamless employee experiences.

People Plus

Security and IT Management

 
Creator

Build custom apps to simplify business processes.

Creator
 
Directory

Workforce identity and access management solution for cloud businesses.

Directory
 
FREE
OneAuth

Secure multi-factor authenticator (MFA) for all your online accounts.

OneAuth
 
Vault

Online password manager for teams.

Vault
 
Catalyst

Pro-code platform to build and deploy your apps.

Catalyst
 
Toolkit

Complete resource for any admin-related lookup queries.

Toolkit
 
Lens

Interactive remote assistance software with augmented reality.

Lens
 
Assist

Remote support and unattended remote access software.

Assist
 
QEngine

Test automation software to build, manage, execute, and report testcases.

QEngine
 
NEW
RPA

Automate manual, tedious, and repetitive tasks easily.

RPA

BI and Analytics

 
Analytics

Modern self-service BI and analytics platform.

Analytics
 
Embedded BI

Embedded analytics and white label BI solutions, tailored for your needs.

Embedded BI
 
DataPrep

AI-powered data preparation service for your data-driven organization.

DataPrep
 
NEW
IoT

Harnessing IoT analytics for real-time operational intelligence.

IoT

Project Management

 
Projects

Manage, track, and collaborate on projects with teams.

Projects
 
Sprints

Planning and tracking tool for scrum teams.

Sprints
 
BugTracker

Automatic bug tracking software for managing bugs.

BugTracker
 
NEW
Solo

The all-in-one toolkit for solopreneurs.

Solo
 
Suites
Projects Plus

Unified project management platform for intelligent, data-driven work.

Projects Plus

Developer Platforms

 
Creator

Build custom apps to simplify business processes.

Creator
 
Flow

Automate business workflows by creating smart integrations.

Flow
 
Catalyst

Pro-code platform to build and deploy your apps.

Catalyst
 
Office Integrator

Built in document editors for web apps.

Office Integrator
 
ZeptoMail

Secure and reliable transactional email sending service.

ZeptoMail
 
QEngine

Test automation software to build, manage, execute, and report testcases.

QEngine
 
Tables

Work management tool to connect people, processes, and information.

Tables
 
NEW
RPA

Automate manual, tedious, and repetitive tasks easily.

RPA
 
NEW
Apptics

Application analytics for all apps.

Apptics
 
Embedded BI

Embedded analytics and white label BI solutions, tailored for your needs.

Embedded BI
 
NEW
IoT

Build, deploy, and scale IoT solutions for connected businesses.

IoT
 
DataPrep

AI-powered data preparation service for your data-driven organization.

DataPrep

IoT

 
NEW
IoT

Low-code IoT platform and solutions for connected businesses.

IoT

Search Result

 
CRM Plus

Unified platform to deliver top-notch customer experience.

Try now
CRM Plus
 
Service Plus

Unified platform for customer service and support teams.

Try now
Service Plus
 
Finance Plus

All-in-one suite to manage your operations and finances.

Try now
Finance Plus
 
People Plus

Comprehensive HR platform for seamless employee experiences.

Try now
People Plus
 
Workplace

Application suite built to improve team productivity and collaboration.

Try now
Workplace
 
Marketing Plus

Unified marketing platform for marketing teams.

Try now
Marketing Plus
 
Projects Plus

Unified project management platform for intelligent, data-driven work.

Try now
Projects Plus
 
All-in-one suite

Zoho One

The Operating System for Business

Run your entire business on Zoho with our unified cloud software, designed to help you break down silos between departments and increase organizational efficiency.

TRY ZOHO ONE
Zoho One
Zoho Marketplace

With over 2000 ready-to-use extensions across 40+ categories, connect your favorite business tools with the Zoho products you already use.

EXPLORE MARKETPLACE
Marketplace
Skip to main content

C# SDK Samples - Record Operations

Get Specific Record details
              
              
/** Get a specific record */
public void GetRecord()
{
    ZCRMModule module = ZCRMModule.GetInstance("Leads");
    APIResponse response = module.GetRecord(538518000449026);
    ZCRMRecord record = (ZCRMRecord)response.Data;
    Console.WriteLine(record.EntityId); //To get record id
    Console.WriteLine(record.ModuleAPIName); //To get module api name
    Console.WriteLine(record.LookupLabel); //To get lookup object name

    ZCRMUser createdBy = record.CreatedBy;
    Console.WriteLine(createdBy.Id); //To get UserId who created the record
    Console.WriteLine(createdBy.FullName); //To get User name who created the record

    ZCRMUser modifiedBy = record.ModifiedBy;
    Console.WriteLine(modifiedBy.Id); //To get UserId who modified the record
    Console.WriteLine(modifiedBy.FullName); //To get User name who modified the record

    ZCRMUser owner = record.Owner;
    Console.WriteLine(owner.Id); //To get record OwnerId
    Console.WriteLine(owner.FullName);//To get record Owner name

    Console.WriteLine(record.CreatedTime); //To get record created time
    Console.WriteLine(record.ModifiedTime); //To get record modified time
    //Console.WriteLine(record.GetFieldValue("Last_Name")); //To get particular field value 

    if (record.Tags.Count > 0)
        {
            foreach (ZCRMTag tagnames in record.Tags)
            {
                Console.WriteLine(tagnames.Id);
                Console.WriteLine(tagnames.Name);
            }
            Console.WriteLine("\n\n");
        }
    Dictionary<string, object> recordData = record.Data; //Returns record as Dictionary

    //Console.WriteLine(record.PriceDetails);
    foreach (KeyValuePair<string, object> data in record.Data)
    {
        if (data.Value is ZCRMRecord recordValue) //If data.Value is ZCRMRecord instance 
        {
            Console.WriteLine(recordValue.EntityId); //To get record id
            Console.WriteLine(recordValue.ModuleAPIName); //To get module api name
            Console.WriteLine(recordValue.LookupLabel); //To get lookup object name
        }
        else if(data.Value is List<string>)
                {
                    Console.WriteLine(data.Key);
                    foreach (string tag in (List<string>)data.Value)
    			{
    			    Console.WriteLine(files.FileId);
    			    Console.WriteLine(files.FileName);
    			    Console.WriteLine(files.AttachmentId);
    			    Console.WriteLine(files.EntityId);
    			}
    		Console.WriteLine("\n\n");
		}
        else if (data.Value is List<string>)
        {
            foreach (string tagnames in (List<string>)data.Value)
            {
                Console.WriteLine(tagnames);
            }
            Console.WriteLine("\n\n");
        }
        else //data.Value is not ZCRMRecord instance
        {
            Console.WriteLine(data.Key + "\t" + data.Value);
        }
    }
    Console.WriteLine("\n\n");

    /** Fields which start with "$" are considered to be property fields */
    //Console.WriteLine(record.GetProperty("$fieldName")); //To get a particular property value
    Dictionary<string, object> properties = record.Properties; //To get record properties as Dictionary
    foreach (KeyValuePair<string, object> property in properties)
    {
        if (property.Value is List<string>) //If value is an array
        {
            Console.WriteLine("\n\n" + property.Key);
            foreach (string data in (List<string>)property.Value)
            {
                Console.WriteLine(data + "\t");
            }
        }
        else if (property.Value is Dictionary<string, object>)
        {
            Console.WriteLine("\n\n" + property.Key);
            foreach (KeyValuePair<string, object> data in (Dictionary<string, object>)property.Value)
            {
                if (property.Value is Dictionary<string, object>)
                {
                    foreach (KeyValuePair<string, object> data1 in (Dictionary<string, object>)data.Value)
                    {
                        Console.WriteLine(data1.Key + "\t" + data1.Value);
                    }
                }
                else
                {
                    Console.WriteLine(data.Key + "\t" + data.Value);
                }
            }
        }
        else
        {
            Console.WriteLine(property.Key + "\t" + property.Value);
        }
    }

    //BulkAPIResponse<ZCRMRecord> relatedlist = record.GetRelatedListRecords("Products"); //To get Related records of a record
    ///** Related records is of type ZCRMRecord **/
    //List<ZCRMRecord> lists = relatedlist.BulkData; //To get related list data
    //foreach (ZCRMRecord rec in lists)
    //{
    //Console.WriteLine(rec.EntityId); //To get  record id
    //Console.WriteLine(rec.ModuleAPIName); //To get module api name
    //}

    BulkAPIResponse<ZCRMNote> noteResponse = record.GetNotes(); //To get record notes
    //BulkAPIResponse<ZCRMNote> noteResponse = record.GetNotes(1,10); //page, perPage.
    //BulkAPIResponse<ZCRMNote> noteResponse = record.GetNotes("title", CommonUtil.SortOrder.asc); //sortByField, sortOrder
    //BulkAPIResponse<ZCRMNote> noteResponse = record.GetNotes("title", CommonUtil.SortOrder.asc,1,10, "2019-12-25T04:00:00+02:00"); //sortByField, sortOrder, page, perPage and modifiedSince(Header)
    List<ZCRMNote> notes = noteResponse.BulkData;
    foreach (ZCRMNote note in notes)
    {
        Console.WriteLine(note.Id); //To get note id
        Console.WriteLine(note.Title); //To get note title
        Console.WriteLine(note.Content); //To get note content

        ZCRMRecord parentRecord = note.ParentRecord; //To get note's parent record
        Console.WriteLine(parentRecord.EntityId); //To get note's parent record id
        Console.WriteLine(parentRecord.ModuleAPIName); // To get note's parent record Module API name

        ZCRMUser noteCreatedBy = note.CreatedBy;
        Console.WriteLine(noteCreatedBy.Id); //To get UserId who created the notes
        Console.WriteLine(noteCreatedBy.FullName); //To get User name who created the notes

        ZCRMUser noteModifiedBy = note.ModifiedBy;
        Console.WriteLine(noteModifiedBy.Id); //To get UserId who modified the notes
        Console.WriteLine(noteModifiedBy.FullName); //To get User name who modified the notes

        ZCRMUser noteOwner = note.NotesOwner;
        Console.WriteLine(noteOwner.Id); //To get notes OwnerId
        Console.WriteLine(noteOwner.FullName); //To get notes Owner name

        Console.WriteLine(note.CreatedTime); //To get created time of the note
        Console.WriteLine(note.ModifiedTime); //To get modified time of the note

        List<ZCRMAttachment> noteAttachment = note.Attachments; //To get attachments of the note record
        if (noteAttachment != null) //check If attachments is empty/not
        {
            foreach (ZCRMAttachment attachment in noteAttachment)
            {
                Console.WriteLine(attachment.Id); //To get the note's attachment id
                Console.WriteLine(attachment.FileName); //To get the note's attachment file name
                Console.WriteLine(attachment.FileType); //To get the note's attachment file type
                Console.WriteLine(attachment.Size); //To get the note's attachment file size

                ZCRMRecord attachmentRecord = attachment.ParentRecord;
                Console.WriteLine(attachmentRecord.EntityId); //To get the note's parent record id
                Console.WriteLine(attachmentRecord.ModuleAPIName); //To get the record name

                ZCRMUser noteAttachmentCreatedBy = note.CreatedBy;
                Console.WriteLine(noteAttachmentCreatedBy.Id); // To get user_id who created the note's attachment
                Console.WriteLine(noteAttachmentCreatedBy.FullName); //To get user name who created the note's attachment

                ZCRMUser noteAttachmentModifiedBy = note.ModifiedBy;
                Console.WriteLine(noteAttachmentModifiedBy.Id); //To get user_id who modified the note's attachment
                Console.WriteLine(noteAttachmentModifiedBy.FullName); //To get user name who modified the note's attachment

                ZCRMUser noteAttachmentOwner = note.NotesOwner;
                Console.WriteLine(noteAttachmentOwner.Id); //To get the note's attachment owner id
                Console.WriteLine(noteAttachmentOwner.FullName); //To get the note's attachment owner name

                Console.WriteLine(attachment.CreatedTime); //To get attachment created time
                Console.WriteLine(attachment.ModifiedTime); //To get attachment modified time
            }
        }
    }

    BulkAPIResponse<ZCRMAttachment> attachmentResponse = record.GetAttachments(); //To get record's attachments 
    //BulkAPIResponse<ZCRMAttachment> attachmentResponse = record.GetAttachments(0,10, "019-12-25T04:00:00+02:00"); //page, perPage and modifiedSince(Header)
    List<ZCRMAttachment> attachments = attachmentResponse.BulkData; // To get list of attachments
    foreach (ZCRMAttachment attachment in attachments)
    {
        Console.WriteLine(attachment.Id); //To get the attachment id
        Console.WriteLine(attachment.FileName); //To get attachment file name
        Console.WriteLine(attachment.FileType); // To get attachment file type
        Console.WriteLine(attachment.Size); //To get attachment file size

        ZCRMRecord attachmentRecord = attachment.ParentRecord;
        Console.WriteLine(attachmentRecord.EntityId); //To get the parent record id
        Console.WriteLine(attachmentRecord.ModuleAPIName); //To get the parent record name

        ZCRMUser attachmentCreatedBy = attachment.CreatedBy;
        Console.WriteLine(attachmentCreatedBy.Id); // To get user_id who created the  attachment
        Console.WriteLine(attachmentCreatedBy.FullName); //To get user name who created the  attachment

        ZCRMUser attachmentModifiedBy = attachment.ModifiedBy;
        Console.WriteLine(attachmentModifiedBy.Id); //To get user_id who modified the attachment
        Console.WriteLine(attachmentModifiedBy.FullName); //To get user name who modified the attachment

        ZCRMUser noteAttachmentOwner = attachment.Owner;
        Console.WriteLine(noteAttachmentOwner.Id); //To get the attachment owner id
        Console.WriteLine(noteAttachmentOwner.FullName); //To get the attachment owner name

        Console.WriteLine(attachment.CreatedTime); //To get attachment created time
        Console.WriteLine(attachment.ModifiedTime); //To get attachment modified time

        FileAPIResponse fResponse = attachment.DownloadFile(); //To download the attachment file
        Console.WriteLine("File Name:" + fResponse.GetFileName()); // To get attachment file name
        Console.WriteLine("HTTP Status Code:" + fResponse.HttpStatusCode); //To get HTTP status code 
        Stream file = fResponse.GetFileAsStream(); //To get attachment file content
        CommonUtil.SaveStreamAsFile("/Users/Desktop/photo", file, fResponse.GetFileName()); //To write a new file using the same attachment name
    }


    ZCRMLayout layout = record.Layout; //To get record layout
    if (layout != null)
    {
        Console.WriteLine(layout.Id); //To get layout_id
        Console.WriteLine(layout.Name); //To get layout name 
    }

    /** Following methods are being used only by Inventory modules */
    List<ZCRMTax> taxlists = record.TaxList; //To get the tax list
    foreach (ZCRMTax tax in taxlists)
    {
        Console.WriteLine(tax.TaxName); //To get tax name
        Console.WriteLine(tax.Percentage); //To get tax percentage
        Console.WriteLine(tax.Value); //To get tax value
    }

    List<ZCRMInventoryLineItem> lineItems = record.LineItems; //To get list of line_items
    foreach (ZCRMInventoryLineItem lineItem in lineItems)
    {
        Console.WriteLine(lineItem.Id); //To get lineItem id
        Console.WriteLine(lineItem.ListPrice); //To get lineItem list price
        Console.WriteLine(lineItem.Quantity); //To get lineItem quantity
        Console.WriteLine(lineItem.Description); //To get lineItem description
        Console.WriteLine(lineItem.Total); //To get lineItem total amount
        Console.WriteLine(lineItem.Discount); //To get lineItem discount
        Console.WriteLine(lineItem.DiscountPercentage); //To get lineItem discount percentage
        Console.WriteLine(lineItem.TotalAfterDiscount); //To get lineItem amount after discount
        Console.WriteLine(lineItem.TaxAmount); //To get lineItem tax amount
        Console.WriteLine(lineItem.NetTotal); //To get lineItem net total amount
        Console.WriteLine(lineItem.UnitPrice); //To get lineItem unit price
        Console.WriteLine(lineItem.Product.EntityId); //To get line_item product's entity id
        Console.WriteLine(lineItem.Product.LookupLabel); //To get line_item product's lookup label

        List<ZCRMTax> linetaxs = lineItem.LineTax; //To get list of line_tax in lineItem
        foreach (ZCRMTax tax in linetaxs)
        {
            Console.WriteLine(tax.TaxName); //To get line tax name
            Console.WriteLine(tax.Percentage); //To get line tax percentage
            Console.WriteLine(tax.Value); //To get line tax value
        }
    }

    List<ZCRMPriceBookPricing> pricedetails = record.PriceDetails; //To get the price details array
    foreach (ZCRMPriceBookPricing pricedetail in pricedetails)
    {
        Console.WriteLine(pricedetail.Id); //To get the record's priceId
        Console.WriteLine(pricedetail.ToRange); //To get the price detail record's to_range
        Console.WriteLine(pricedetail.FromRange); //To get the price detail record's from_range
        Console.WriteLine(pricedetail.Discount); //To get the price detail record's discount
    }
    /**  End Inventory **/

    /** Following method is used only by 'Events' module */
    List<ZCRMEventParticipant> participants = record.Participants; //To get Event record's participants
    foreach (ZCRMEventParticipant participant in participants)
    {
        Console.WriteLine(participant.Id); //To get the record's participant id
        Console.WriteLine(participant.Name); //To get the record's participant name
        Console.WriteLine(participant.Email);//To get the record's participant email
        Console.WriteLine(participant.Type); //To get the record's participant type
        Console.WriteLine(participant.IsInvited); //To check if the record's participant(s) are invited or not
        Console.WriteLine(participant.Status); //To get the record's participants' status
    }
     End Event 
}
 
Create a Record
              
              
/** Insert a specific record */
public void InsertRecord()
{
    ZCRMRecord record = new ZCRMRecord("Leads"); //To get ZCRMRecord instance
    record.SetFieldValue("Subject", "UpdateInvoice4"); //This method use to set FieldApiName and value similar to all other FieldApis and Custom field 
    record.SetFieldValue("Account_Name", 3372164001855101);
    record.SetFieldValue("Company", "KK");
    record.SetFieldValue("Last_Name", "User");
    record.SetFieldValue("Customfield", "CustomFieldValue");
    record.SetFieldValue("Price_Book_Name", "Price_Book_Name");
    
    //Following methods are used to upload a file to a field
    
    List<ZCRMFiles> fileObjects = new List<ZCRMFiles>();
	ZCRMFiles file = ZCRMFiles.GetInstance("aexxxxxxxxxx732e26505e22e", null);
	fileObjects.Add(file);
	file = ZCRMFiles.GetInstance("aexxxxxxxxxx732e26505e22e", null);
	fileObjects.Add(file);
	record.SetFieldValue("File_Upload", fileObjects);

    /** Following methods are being used only by Inventory modules */
    ZCRMPriceBookPricing pricing1;

    pricing1 = new ZCRMPriceBookPricing
    {
        ToRange = 5,
        FromRange = 1,
        Discount = 0
    };
    record.AddPriceDetail(pricing1);

    pricing1 = new ZCRMPriceBookPricing
    {
        ToRange = 11,
        FromRange = 6,
        Discount = 1
    };
    record.AddPriceDetail(pricing1);

    pricing1 = new ZCRMPriceBookPricing
    {
        ToRange = 17,
        FromRange = 12,
        Discount = 2
    };
    record.AddPriceDetail(pricing1);

    pricing1 = new ZCRMPriceBookPricing
    {
        ToRange = 23,
        FromRange = 18,
        Discount = 3
    };
    record.AddPriceDetail(pricing1);

    record.SetFieldValue("Pricing_Model", "Flat");
    ZCRMTax linetax = ZCRMTax.GetInstance("Sales Tax");
    linetax.Percentage = 12.5;
    record.AddTax(linetax);

    ZCRMRecord product1 = ZCRMRecord.GetInstance("Products", 3372164000190001); // product instance

    ZCRMInventoryLineItem lineItem1 = new ZCRMInventoryLineItem(product1)
    {
        Description = "Product_description", //To set line item description
        Discount = 5, //To set line item discount
        ListPrice = 100 //To set line item list price

    }; //To get ZCRMInventoryLineItem instance
    lineItem1.DiscountPercentage = 10;
    ZCRMTax taxInstance11 = ZCRMTax.GetInstance("Sales Tax"); //To get ZCRMTax instance
    taxInstance11.Percentage = 2; //To set tax percentage
    taxInstance11.Value = 50; //To set tax value
    lineItem1.AddLineTax(taxInstance11); //To set line tax to line item

    taxInstance11 = ZCRMTax.GetInstance("Vat");
    taxInstance11.Percentage = 12;
    taxInstance11.Value = 50;

    lineItem1.AddLineTax(taxInstance11);
    lineItem1.Quantity = 500; //To set product quantity to this line item

    record.AddLineItem(lineItem1); //The line item set to the record object
    /** End Inventory **/
    List<string> trigger = new List<string>() { "workflow", "approval", "blueprint" };
	string larID = "3477061000004353013";
	APIResponse response = record.Create(trigger, larID); //To call the Update record method

    ZCRMRecord record1 = (ZCRMRecord)response.Data;

    Console.WriteLine("EntityId:" + record1.EntityId); //To get update record id
    Console.WriteLine(record1.ModifiedTime);
    Console.WriteLine(record1.CreatedTime);
    ZCRMUser CreatedBy = record1.CreatedBy;
    if(CreatedBy != null)
    {
        Console.WriteLine(CreatedBy.Id);
        Console.WriteLine(CreatedBy.FullName);
    }
    ZCRMUser ModifiedBy = record1.ModifiedBy;
    if (ModifiedBy != null)
    {
        Console.WriteLine(ModifiedBy.Id);
        Console.WriteLine(ModifiedBy.FullName);
    }
    Console.WriteLine("HTTP Status Code:" + response.HttpStatusCode); //To get Update record http response code
    Console.WriteLine("Status:" + response.Status); //To get Update record response status
    Console.WriteLine("Message:" + response.Message); //To get Update record response message
    Console.WriteLine("Details:" + response.ResponseJSON); //To get Update record response details
}
 
Update a Record
Delete a Record
              
              
/** Delete a specific record */
public void DeleteRecord()
{
    /** Delete a specific record */
    ZCRMRecord record = ZCRMRecord.GetInstance("Vendors", 538518000440472);//module api name with record id
    APIResponse response = record.Delete();
    Console.WriteLine("Status:" + response.Status); //To get delete record response status
    Console.WriteLine("Message:" + response.Message); //To get delete record response message
    Console.WriteLine("Details:" + response.ResponseJSON); //To get delete record response details
    ZCRMRecord record1 = (ZCRMRecord)response.Data;
    Console.WriteLine(record1.EntityId); //To get inserted record id
    Console.WriteLine(record1.ModuleAPIName);
}
 
Convert a Record
              
              
/** Convert Lead */
public void ConvertLead()
{
    /** Convert Lead */
    ZCRMRecord record = ZCRMRecord.GetInstance("Leads", 538518000451020); //module api name with record id
    ZCRMRecord potentialRecord = new ZCRMRecord("Deals"); // module api name
    potentialRecord.SetFieldValue("Stage", "Qualification");
    potentialRecord.SetFieldValue("Closing_Date", "2019-01-25");
    potentialRecord.SetFieldValue("Deal_Name", "Deal_Name");
    ZCRMUser user = ZCRMUser.GetInstance(538518000231013);
    Dictionary<string, long> response = record.Convert(potentialRecord, user); // response is KeyValuePair 
    foreach(KeyValuePair<string, long> data in response)
    {
        Console.WriteLine(data.Key + ":" + data.Value);
    }
}
 
Notes in a Record
Get a Note
              
              
/** Get specific notes data */
public void GetNotes()
{
    /** Get specific notes data */
    ZCRMRecord recordIns = ZCRMRecord.GetInstance("Leads", 538518000449026); //module api name with record id
    BulkAPIResponse<ZCRMNote> response = recordIns.GetNotes();
    List<ZCRMNote> notes = response.BulkData; //notes - list of ZCRMNote instance
    foreach (ZCRMNote note in notes)
    {
        Console.WriteLine(note.Id);
        Console.WriteLine(note.Title);
        Console.WriteLine(note.Content);
        ZCRMUser CreatedBy = note.CreatedBy;
        if(CreatedBy!=null)
        {
            Console.WriteLine(CreatedBy.Id);
            Console.WriteLine(CreatedBy.FullName);
        }

        Console.WriteLine(note.CreatedTime);
        Console.WriteLine(note.ModifiedTime);

        ZCRMUser ModifiedBy = note.ModifiedBy;
        if (ModifiedBy != null)
        {
            Console.WriteLine(ModifiedBy.Id);
            Console.WriteLine(ModifiedBy.FullName);
        }

        ZCRMUser NotesOwner = note.NotesOwner;
        if (NotesOwner != null)
        {
            Console.WriteLine(NotesOwner.Id);
            Console.WriteLine(NotesOwner.FullName);
        }

        ZCRMRecord ParentRecord = note.ParentRecord;
        Console.WriteLine(ParentRecord.EntityId);
        Console.WriteLine(ParentRecord.ModuleAPIName);

        List<ZCRMAttachment> noteAttachment = note.Attachments; //To get attachments of the note record
        if (noteAttachment != null) //check If attachments is empty/not
        {
            foreach (ZCRMAttachment attachment in noteAttachment)
            {
                Console.WriteLine(attachment.Id); //To get the note's attachment id
                Console.WriteLine(attachment.FileName); //To get the note's attachment file name
                Console.WriteLine(attachment.FileType); //To get the note's attachment file type
                Console.WriteLine(attachment.Size); //To get the note's attachment file size

                ZCRMRecord attachmentRecord = attachment.ParentRecord;
                Console.WriteLine(attachmentRecord.EntityId); //To get the note's parent record id
                Console.WriteLine(attachmentRecord.ModuleAPIName); //To get the record name

                ZCRMUser noteAttachmentCreatedBy = note.CreatedBy;
                Console.WriteLine(noteAttachmentCreatedBy.Id); // To get user_id who created the note's attachment
                Console.WriteLine(noteAttachmentCreatedBy.FullName); //To get user name who created the note's attachment

                ZCRMUser noteAttachmentModifiedBy = note.ModifiedBy;
                Console.WriteLine(noteAttachmentModifiedBy.Id); //To get user_id who modified the note's attachment
                Console.WriteLine(noteAttachmentModifiedBy.FullName); //To get user name who modified the note's attachment

                ZCRMUser noteAttachmentOwner = note.NotesOwner;
                Console.WriteLine(noteAttachmentOwner.Id); //To get the note's attachment owner id
                Console.WriteLine(noteAttachmentOwner.FullName); //To get the note's attachment owner name

                Console.WriteLine(attachment.CreatedTime); //To get attachment created time
                Console.WriteLine(attachment.ModifiedTime); //To get attachment modified time
            }
        }
    }
}
 
Add a Note
              
              
/** Create specific notes */
public void AddNote()
{
    ZCRMRecord recordIns = ZCRMRecord.GetInstance("Leads", 538518000449026); //module api name with record id
    ZCRMNote note = new ZCRMNote(recordIns);
    note.Content = "test msg";
    note.Title = "test class notes";
    APIResponse response = recordIns.AddNote(note);
    ZCRMNote createdNote = (ZCRMNote)response.Data;
    Console.WriteLine(createdNote.Id);
    Console.WriteLine(createdNote.CreatedTime);
    Console.WriteLine(createdNote.ModifiedTime);
    Console.WriteLine(createdNote.Title);
    Console.WriteLine(createdNote.Content);

    Console.WriteLine(response.Status);
    Console.WriteLine(response.Message);
}
 
Update a Note
              
              
/** Update notes */
public void UpdateNote()
{
    ZCRMRecord recordIns = ZCRMRecord.GetInstance("Leads", 538518000449026); //module api name with record id
    ZCRMNote note = ZCRMNote.GetInstance(recordIns, 538518000449095); //record instance with note id
    note.Content = "update message";
    APIResponse response = recordIns.UpdateNote(note);
    ZCRMNote updatedNote = (ZCRMNote)response.Data;
    Console.WriteLine(updatedNote.Id);
    Console.WriteLine(updatedNote.CreatedTime);
    Console.WriteLine(updatedNote.ModifiedTime);
    Console.WriteLine(updatedNote.Title);
    Console.WriteLine(updatedNote.Content);

    Console.WriteLine(response.Status);
    Console.WriteLine(response.Message);
}
 
Delete a Note
              
              
/** Delete specific notes */
public void DeleteNote()
{
    ZCRMRecord recordIns = ZCRMRecord.GetInstance("Leads", 538518000449026); //module api name with record id
    ZCRMNote note = ZCRMNote.GetInstance(recordIns, 538518000449095); //record instance with note id
    APIResponse response = recordIns.DeleteNote(note);
    Console.WriteLine(response.Status);
    Console.WriteLine(response.Message);
}
 
Files & Attachments in a Record
Get Attachments
              
              
/** Get list of attachments */
public void GetAllAttachments()
{
    /** Get list of attachments */
    ZCRMRecord recordIns = ZCRMRecord.GetInstance("Leads", 538518000449026); //module api name with record id
    BulkAPIResponse<ZCRMAttachment> response = recordIns.GetAttachments();
    List<ZCRMAttachment> attachments = response.BulkData; //attachments - list of ZCRMAttachment instance
    foreach (ZCRMAttachment attachment in attachments)
    {
        Console.WriteLine(attachment.Id); //To get the attachment id
        Console.WriteLine(attachment.FileName); //To get attachment file name
        Console.WriteLine(attachment.FileType); // To get attachment file type
        Console.WriteLine(attachment.Size); //To get attachment file size

        ZCRMRecord attachmentRecord = attachment.ParentRecord;
        Console.WriteLine(attachmentRecord.EntityId); //To get the parent record id
        Console.WriteLine(attachmentRecord.ModuleAPIName); //To get the parent record name

        ZCRMUser attachmentCreatedBy = attachment.CreatedBy;
        Console.WriteLine(attachmentCreatedBy.Id); // To get user_id who created the  attachment
        Console.WriteLine(attachmentCreatedBy.FullName); //To get user name who created the  attachment

        ZCRMUser attachmentModifiedBy = attachment.ModifiedBy;
        Console.WriteLine(attachmentModifiedBy.Id); //To get user_id who modified the attachment
        Console.WriteLine(attachmentModifiedBy.FullName); //To get user name who modified the attachment

        ZCRMUser noteAttachmentOwner = attachment.Owner;
        Console.WriteLine(noteAttachmentOwner.Id); //To get the attachment owner id
        Console.WriteLine(noteAttachmentOwner.FullName); //To get the attachment owner name

        Console.WriteLine(attachment.CreatedTime); //To get attachment created time
        Console.WriteLine(attachment.ModifiedTime); //To get attachment modified time

        FileAPIResponse fResponse = attachment.DownloadFile(); //To download the attachment file
        Console.WriteLine("File Name:" + fResponse.GetFileName()); // To get attachment file name
        Console.WriteLine("HTTP Status Code:" + fResponse.HttpStatusCode); //To get HTTP status code 
        Stream file = fResponse.GetFileAsStream(); //To get attachment file content
        CommonUtil.SaveStreamAsFile("/Users/test/Desktop/photo", file, fResponse.GetFileName()); //To write a new file using the same attachment name
    }
}
 
Upload an Attachment
              
              
/** Upload an attachment */
public void UploadAttachment()
{
    /** Upload an attachment */
    ZCRMRecord recordIns = ZCRMRecord.GetInstance("Leads", 538518000449026);//module api name with record id
    APIResponse response = recordIns.UploadAttachment("/Users/Desktop/testreport/index.htm");
    ZCRMAttachment attachment = (ZCRMAttachment)response.Data;
    Console.WriteLine(attachment.Id); //To get the attachment id
    Console.WriteLine(attachment.FileName); //To get attachment file name
    Console.WriteLine(attachment.FileType); // To get attachment file type
    Console.WriteLine(attachment.Size); //To get attachment file size

    ZCRMRecord attachmentRecord = attachment.ParentRecord;
    Console.WriteLine(attachmentRecord.EntityId); //To get the parent record id
    Console.WriteLine(attachmentRecord.ModuleAPIName); //To get the parent record name

    ZCRMUser attachmentCreatedBy = attachment.CreatedBy;
    Console.WriteLine(attachmentCreatedBy.Id); // To get user_id who created the  attachment
    Console.WriteLine(attachmentCreatedBy.FullName); //To get user name who created the  attachment

    ZCRMUser attachmentModifiedBy = attachment.ModifiedBy;
    Console.WriteLine(attachmentModifiedBy.Id); //To get user_id who modified the attachment
    Console.WriteLine(attachmentModifiedBy.FullName); //To get user name who modified the attachment

    ZCRMUser noteAttachmentOwner = attachment.Owner;
    Console.WriteLine(noteAttachmentOwner.Id); //To get the attachment owner id
    Console.WriteLine(noteAttachmentOwner.FullName); //To get the attachment owner name

    Console.WriteLine(attachment.CreatedTime); //To get attachment created time
    Console.WriteLine(attachment.ModifiedTime); //To get attachment modified time

    FileAPIResponse fResponse = attachment.DownloadFile(); //To download the attachment file
    Console.WriteLine("File Name:" + fResponse.GetFileName()); // To get attachment file name
    Console.WriteLine("HTTP Status Code:" + fResponse.HttpStatusCode); //To get HTTP status code 
    Stream file = fResponse.GetFileAsStream(); //To get attachment file content
    CommonUtil.SaveStreamAsFile("/Users/Desktop/photo", file, fResponse.GetFileName()); //To write a new file using the same attachment name
}
 
              
              
/** Upload an attachment link */
public void UploadAttachmentLink()
{
    ZCRMRecord record = ZCRMRecord.GetInstance("Leads", 538518000449026);
    APIResponse response = record.UploadLinkAsAttachment("(attachment url)");
    ZCRMAttachment attachment = (ZCRMAttachment)response.Data;
    Console.WriteLine(attachment.Id); //To get the attachment id
    Console.WriteLine(attachment.FileName); //To get attachment file name
    Console.WriteLine(attachment.FileType); // To get attachment file type
    Console.WriteLine(attachment.Size); //To get attachment file size

    ZCRMRecord attachmentRecord = attachment.ParentRecord;
    Console.WriteLine(attachmentRecord.EntityId); //To get the parent record id
    Console.WriteLine(attachmentRecord.ModuleAPIName); //To get the parent record name

    ZCRMUser attachmentCreatedBy = attachment.CreatedBy;
    Console.WriteLine(attachmentCreatedBy.Id); // To get user_id who created the  attachment
    Console.WriteLine(attachmentCreatedBy.FullName); //To get user name who created the  attachment

    ZCRMUser attachmentModifiedBy = attachment.ModifiedBy;
    Console.WriteLine(attachmentModifiedBy.Id); //To get user_id who modified the attachment
    Console.WriteLine(attachmentModifiedBy.FullName); //To get user name who modified the attachment

    ZCRMUser noteAttachmentOwner = attachment.Owner;
    Console.WriteLine(noteAttachmentOwner.Id); //To get the attachment owner id
    Console.WriteLine(noteAttachmentOwner.FullName); //To get the attachment owner name

    Console.WriteLine(attachment.CreatedTime); //To get attachment created time
    Console.WriteLine(attachment.ModifiedTime); //To get attachment modified time

    Console.WriteLine(response.Status);
    Console.WriteLine(response.Message);
}
 
Download an Attachment
              
              
/** Download an attachment */
public void DownloadAttachment()
{
    /** Download an attachment */
    ZCRMRecord recordIns = ZCRMRecord.GetInstance("Leads", 538518000449026); //module api name with record id
    FileAPIResponse response = recordIns.DownloadAttachment(538518000451099); //attachmentID
    Stream file = response.GetFileAsStream();
    CommonUtil.SaveStreamAsFile("/Users/Desktop/photo", file, response.GetFileName());
    Console.WriteLine(response.Status);
}
 
Delete an Attachment
              
              
/** Delete attachments */
public void DeleteAttachment()
{
    /** Delete attachments */
    ZCRMRecord recordIns = ZCRMRecord.GetInstance("Leads", 538518000449026); //module api name with record id
    APIResponse response = recordIns.DeleteAttachment(538518000451099); //attachmentID
    Console.WriteLine(response.ResponseJSON); //attachment is JArray
}
 
Images in a Record
Upload a Photo
              
              
/** Upload a photo */
public void UploadPhoto()
{
    /** Upload a photo */
    ZCRMRecord recordIns = ZCRMRecord.GetInstance("Leads", 538518000449026); //module apiname with record id
    APIResponse response = recordIns.UploadPhoto("/Users/Desktop/zoho-crm.jpg");
    Console.WriteLine(response.ResponseJSON); //photo is JArray
}
 
Download a Photo
              
              
/** Download a photo */
public void DownloadPhoto()
{
    /** Download a photo */
    ZCRMRecord recordIns = ZCRMRecord.GetInstance("Leads", 538518000449026); //module apiname with record id
    FileAPIResponse response = recordIns.DownloadPhoto();
    Stream photoStream = response.GetFileAsStream();
    CommonUtil.SaveStreamAsFile("/Users/Desktop/test", photoStream, response.GetFileName());
    Console.WriteLine(response.Status);
}
 
Delete a Photo
              
              
/** Delete a photo */
public void DeletePhoto()
{
    /** Delete a photo */
    ZCRMRecord recordIns = ZCRMRecord.GetInstance("Leads", 538518000449026); //module apiname with record id
    APIResponse response = recordIns.DeletePhoto();
    Console.WriteLine(response.Status);
}
 
Interlinking Records
Add Relation between Records
              
              
/** Update related records */
public void AddRelation()
{
    ZCRMRecord recordIns = ZCRMRecord.GetInstance("Products", 538518000440452); //module api name with record id
    ZCRMJunctionRecord relatedRecord = ZCRMJunctionRecord.GetInstance("Price_Books", 538518000443803); //RelatedList api name with RelatedList record id
    relatedRecord.SetRelatedDetails("list_price", 50);
    APIResponse response = recordIns.AddRelation(relatedRecord);
    String recStatus = response.Status; //check status of the update relation
    Console.WriteLine(recStatus);
    Console.WriteLine(response.Message);
    Console.WriteLine(response.HttpStatusCode);
    Console.WriteLine(response.ResponseJSON);
}
 
Remove Relation between Records (Delink)
              
              
/** Delink */
public void DeleteRelation()
{
    ZCRMRecord recordIns = ZCRMRecord.GetInstance("Leads", 538518000449026);//module api name with record id
    ZCRMJunctionRecord relatedRecord = ZCRMJunctionRecord.GetInstance("Campaigns", 538518000440462); //RelatedList api name with RelatedList record id
    APIResponse response = recordIns.DeleteRelation(relatedRecord);
    String recStatus = response.Status; //check status of the delete relation
    Console.WriteLine(recStatus);
    Console.WriteLine(response.Message);
    Console.WriteLine(response.HttpStatusCode);
    Console.WriteLine(response.ResponseJSON);
}
 
              
              
/** Get related records */
public void GetRelatedListRecords()
{
    ZCRMRecord recordIns = ZCRMRecord.GetInstance("Leads", 53851800449026); //module api name with record id
    BulkAPIResponse<ZCRMRecord> response = recordIns.GetRelatedListRecords("Products"); //RelatedList api name
    List<ZCRMRecord> relatedRecordsLists = response.BulkData; //relatedRecordsLists - list of ZCRMRecord instance
    foreach (ZCRMRecord record in relatedRecordsLists)
    {
        Console.WriteLine(record.EntityId); //To get record id
        Console.WriteLine(record.ModuleAPIName); //To get module api name
        Console.WriteLine(record.LookupLabel); //To get lookup object name

        ZCRMUser createdBy = record.CreatedBy;
        Console.WriteLine(createdBy.Id); //To get UserId who created the record
        Console.WriteLine(createdBy.FullName); //To get User name who created the record

        ZCRMUser modifiedBy = record.ModifiedBy;
        Console.WriteLine(modifiedBy.Id); //To get UserId who modified the record
        Console.WriteLine(modifiedBy.FullName); //To get User name who modified the record

        ZCRMUser owner = record.Owner;
        Console.WriteLine(owner.Id); //To get record OwnerId
        Console.WriteLine(owner.FullName);//To get record Owner name

        Console.WriteLine(record.CreatedTime); //To get record created time
        Console.WriteLine(record.ModifiedTime); //To get record modified time
        //Console.WriteLine(record.GetFieldValue("Last_Name")); //To get particular field value 

        if (record.Tags.Count > 0)
        {
            foreach (ZCRMTag tagnames in record.Tags)
            {
                Console.WriteLine(tagnames.Id);
                Console.WriteLine(tagnames.Name);
            }
            Console.WriteLine("\n\n");
        }

        Dictionary<string, object> recordData = record.Data; //Returns record as Dictionary

        //Console.WriteLine(record.PriceDetails);
        foreach (KeyValuePair<string, object> data in record.Data)
        {
            if (data.Value is ZCRMRecord recordValue) //If data.Value is ZCRMRecord instance 
            {
                Console.WriteLine(recordValue.EntityId); //To get record id
                Console.WriteLine(recordValue.ModuleAPIName); //To get module api name
                Console.WriteLine(recordValue.LookupLabel); //To get lookup object name
            }
            else if (data.Value is List<string>)
            {
                Console.WriteLine(data.Key);
                foreach (string tag in (List<string>)data.Value)
                {
                    Console.WriteLine(tag);
                }
                Console.WriteLine("\n\n");
            }
            else //data.Value is not ZCRMRecord instance
            {
                Console.WriteLine(data.Key + "\t" + data.Value);
            }
        }
        Console.WriteLine("\n\n");

        /** Fields which start with "$" are considered to be property fields */
        //Console.WriteLine(record.GetProperty("$fieldName")); //To get a particular property value
        Dictionary<string, object> properties = record.Properties; //To get record properties as Dictionary
        foreach (KeyValuePair<string, object> property in properties)
        {
            if (property.Value is List<string>) //If value is an array
            {
                Console.WriteLine("\n\n" + property.Key);
                foreach (string data in (List<string>)property.Value)
                {
                    Console.WriteLine(data + "\t");
                }
            }
            else if (property.Value is Dictionary<string, object>)
            {
                Console.WriteLine("\n\n" + property.Key);
                foreach (KeyValuePair<string, object> data in (Dictionary<string, object>)property.Value)
                {
                    if (property.Value is Dictionary<string, object>)
                    {
                        foreach (KeyValuePair<string, object> data1 in (Dictionary<string, object>)data.Value)
                        {
                            Console.WriteLine(data1.Key + "\t" + data1.Value);
                        }
                    }
                    else
                    {
                        Console.WriteLine(data.Key + "\t" + data.Value);
                    }
                }
            }
            else
            {
                Console.WriteLine(property.Key + "\t" + property.Value);
            }
        }

        //BulkAPIResponse<ZCRMRecord> relatedlist = record.GetRelatedListRecords("Products"); //To get Related records of a record
        ///** Related records is of type ZCRMRecord **/
        //List<ZCRMRecord> lists = relatedlist.BulkData; //To get related list data
        //foreach (ZCRMRecord rec in lists)
        //{
        //    Console.WriteLine(rec.EntityId); //To get  record id
        //    Console.WriteLine(rec.ModuleAPIName); //To get module api name
        //}

        BulkAPIResponse<ZCRMNote> noteResponse = record.GetNotes(); //To get record notes
        //BulkAPIResponse<ZCRMNote> noteResponse = record.GetNotes(1,10); //page, perPage.
        //BulkAPIResponse<ZCRMNote> noteResponse = record.GetNotes("title", CommonUtil.SortOrder.asc); //sortByField, sortOrder
        //BulkAPIResponse<ZCRMNote> noteResponse = record.GetNotes("title", CommonUtil.SortOrder.asc,1,10, "2019-12-25T04:00:00+02:00"); //sortByField, sortOrder, page, perPage and modifiedSince(Header)
        List<ZCRMNote> notes = noteResponse.BulkData;
        foreach (ZCRMNote note in notes)
        {
            Console.WriteLine(note.Id); //To get note id
            Console.WriteLine(note.Title); //To get note title
            Console.WriteLine(note.Content); //To get note content

            ZCRMRecord parentRecord = note.ParentRecord; //To get note's parent record
            Console.WriteLine(parentRecord.EntityId); //To get note's parent record id
            Console.WriteLine(parentRecord.ModuleAPIName); // To get note's parent record Module API name

            ZCRMUser noteCreatedBy = note.CreatedBy;
            Console.WriteLine(noteCreatedBy.Id); //To get UserId who created the notes
            Console.WriteLine(noteCreatedBy.FullName); //To get User name who created the notes

            ZCRMUser noteModifiedBy = note.ModifiedBy;
            Console.WriteLine(noteModifiedBy.Id); //To get UserId who modified the notes
            Console.WriteLine(noteModifiedBy.FullName); //To get User name who modified the notes

            ZCRMUser noteOwner = note.NotesOwner;
            Console.WriteLine(noteOwner.Id); //To get notes OwnerId
            Console.WriteLine(noteOwner.FullName); //To get notes Owner name

            Console.WriteLine(note.CreatedTime); //To get created time of the note
            Console.WriteLine(note.ModifiedTime); //To get modified time of the note

            List<ZCRMAttachment> noteAttachment = note.Attachments; //To get attachments of the note record
            if (noteAttachment != null) //check If attachments is empty/not
            {
                foreach (ZCRMAttachment attachment in noteAttachment)
                {
                    Console.WriteLine(attachment.Id); //To get the note's attachment id
                    Console.WriteLine(attachment.FileName); //To get the note's attachment file name
                    Console.WriteLine(attachment.FileType); //To get the note's attachment file type
                    Console.WriteLine(attachment.Size); //To get the note's attachment file size

                    ZCRMRecord attachmentRecord = attachment.ParentRecord;
                    Console.WriteLine(attachmentRecord.EntityId); //To get the note's parent record id
                    Console.WriteLine(attachmentRecord.ModuleAPIName); //To get the record name

                    ZCRMUser noteAttachmentCreatedBy = note.CreatedBy;
                    Console.WriteLine(noteAttachmentCreatedBy.Id); // To get user_id who created the note's attachment
                    Console.WriteLine(noteAttachmentCreatedBy.FullName); //To get user name who created the note's attachment

                    ZCRMUser noteAttachmentModifiedBy = note.ModifiedBy;
                    Console.WriteLine(noteAttachmentModifiedBy.Id); //To get user_id who modified the note's attachment
                    Console.WriteLine(noteAttachmentModifiedBy.FullName); //To get user name who modified the note's attachment

                    ZCRMUser noteAttachmentOwner = note.NotesOwner;
                    Console.WriteLine(noteAttachmentOwner.Id); //To get the note's attachment owner id
                    Console.WriteLine(noteAttachmentOwner.FullName); //To get the note's attachment owner name

                    Console.WriteLine(attachment.CreatedTime); //To get attachment created time
                    Console.WriteLine(attachment.ModifiedTime); //To get attachment modified time

                }
            }
        }

        BulkAPIResponse<ZCRMAttachment> attachmentResponse = record.GetAttachments(); //To get record's attachments 
        //BulkAPIResponse<ZCRMAttachment> attachmentResponse = record.GetAttachments(0,10, "019-12-25T04:00:00+02:00"); //page, perPage and modifiedSince(Header)
        List<ZCRMAttachment> attachments = attachmentResponse.BulkData; // To get list of attachments
        foreach (ZCRMAttachment attachment in attachments)
        {
            Console.WriteLine(attachment.Id); //To get the attachment id
            Console.WriteLine(attachment.FileName); //To get attachment file name
            Console.WriteLine(attachment.FileType); // To get attachment file type
            Console.WriteLine(attachment.Size); //To get attachment file size

            ZCRMRecord attachmentRecord = attachment.ParentRecord;
            Console.WriteLine(attachmentRecord.EntityId); //To get the parent record id
            Console.WriteLine(attachmentRecord.ModuleAPIName); //To get the parent record name

            ZCRMUser attachmentCreatedBy = attachment.CreatedBy;
            Console.WriteLine(attachmentCreatedBy.Id); // To get user_id who created the  attachment
            Console.WriteLine(attachmentCreatedBy.FullName); //To get user name who created the  attachment

            ZCRMUser attachmentModifiedBy = attachment.ModifiedBy;
            Console.WriteLine(attachmentModifiedBy.Id); //To get user_id who modified the attachment
            Console.WriteLine(attachmentModifiedBy.FullName); //To get user name who modified the attachment

            ZCRMUser noteAttachmentOwner = attachment.Owner;
            Console.WriteLine(noteAttachmentOwner.Id); //To get the attachment owner id
            Console.WriteLine(noteAttachmentOwner.FullName); //To get the attachment owner name

            Console.WriteLine(attachment.CreatedTime); //To get attachment created time
            Console.WriteLine(attachment.ModifiedTime); //To get attachment modified time

            FileAPIResponse fResponse = attachment.DownloadFile(); //To download the attachment file
            Console.WriteLine("File Name:" + fResponse.GetFileName()); // To get attachment file name
            Console.WriteLine("HTTP Status Code:" + fResponse.HttpStatusCode); //To get HTTP status code 
            Stream file = fResponse.GetFileAsStream(); //To get attachment file content
            CommonUtil.SaveStreamAsFile("/Users/pboyle-73/Desktop/photo", file, fResponse.GetFileName()); //To write a new file using the same attachment name
        }


        ZCRMLayout layout = record.Layout; //To get record layout
        if (layout != null)
        {
            Console.WriteLine(layout.Id); //To get layout_id
            Console.WriteLine(layout.Name); //To get layout name 
        }

        /** Following methods are being used only by Inventory modules */
        List<ZCRMTax> taxlists = record.TaxList; //To get the tax list
        foreach (ZCRMTax tax in taxlists)
        {
            Console.WriteLine(tax.TaxName); //To get tax name
            Console.WriteLine(tax.Percentage); //To get tax percentage
            Console.WriteLine(tax.Value); //To get tax value
        }

        List<ZCRMInventoryLineItem> lineItems = record.LineItems; //To get list of line_items
        foreach (ZCRMInventoryLineItem lineItem in lineItems)
        {
            Console.WriteLine(lineItem.Id); //To get lineItem id
            Console.WriteLine(lineItem.ListPrice); //To get lineItem list price
            Console.WriteLine(lineItem.Quantity); //To get lineItem quantity
            Console.WriteLine(lineItem.Description); //To get lineItem description
            Console.WriteLine(lineItem.Total); //To get lineItem total amount
            Console.WriteLine(lineItem.Discount); //To get lineItem discount
            Console.WriteLine(lineItem.DiscountPercentage); //To get lineItem discount percentage
            Console.WriteLine(lineItem.TotalAfterDiscount); //To get lineItem amount after discount
            Console.WriteLine(lineItem.TaxAmount); //To get lineItem tax amount
            Console.WriteLine(lineItem.NetTotal); //To get lineItem net total amount
            Console.WriteLine(lineItem.UnitPrice); //To get lineItem unit price
            Console.WriteLine(lineItem.Product.EntityId); //To get line_item product's entity id
            Console.WriteLine(lineItem.Product.LookupLabel); //To get line_item product's lookup label

            List<ZCRMTax> linetaxs = lineItem.LineTax; //To get list of line_tax in lineItem
            foreach (ZCRMTax tax in linetaxs)
            {
                Console.WriteLine(tax.TaxName); //To get line tax name
                Console.WriteLine(tax.Percentage); //To get line tax percentage
                Console.WriteLine(tax.Value); //To get line tax value
            }
        }

        List<ZCRMPriceBookPricing> pricedetails = record.PriceDetails; //To get the price details array
        foreach (ZCRMPriceBookPricing pricedetail in pricedetails)
        {
            Console.WriteLine(pricedetail.Id); //To get the record's priceId
            Console.WriteLine(pricedetail.ToRange); //To get the price detail record's to_range
            Console.WriteLine(pricedetail.FromRange); //To get the price detail record's from_range
            Console.WriteLine(pricedetail.Discount); //To get the price detail record's discount
        }
        /**  End Inventory **/

        /** Following method is used only by 'Events' module */
        List<ZCRMEventParticipant> participants = record.Participants; //To get Event record's participants
        foreach (ZCRMEventParticipant participant in participants)
        {
            Console.WriteLine(participant.Id); //To get the record's participant id
            Console.WriteLine(participant.Name); //To get the record's participant name
            Console.WriteLine(participant.Email);//To get the record's participant email
            Console.WriteLine(participant.Type); //To get the record's participant type
            Console.WriteLine(participant.IsInvited); //To check if the record's participant(s) are invited or not
            Console.WriteLine(participant.Status); //To get the record's participants' status
        }
         End Event */
    }

}
 
Tags of a Record
Add Tags to Records
              
              
/** Add Tags to a Specific record */
public void AddTagSpecificRecord()
{
    ZCRMRecord tag = ZCRMRecord.GetInstance("Leads", 538518000449026); ///Module API Name, record id
    List<string> tagname = new List<string>() { "N1","N2"};
    APIResponse response = tag.AddTags(tagname); //tagNames is List

    ZCRMRecord tags = (ZCRMRecord)response.Data;
    Console.WriteLine(tags.ModuleAPIName);
    Console.WriteLine(tags.EntityId);
    foreach (string tagnames in tags.TagNames)
    {
        Console.WriteLine(tagnames);
    }
    Console.WriteLine(response.Message);
    Console.WriteLine(response.Status);
    Console.WriteLine(response.HttpStatusCode);
    Console.WriteLine(response.ResponseJSON);
}
 
Remove Tags from Records
              
              
/** Remove Tags from a Specific record */
public void RemoveTagSpecificRecord()
{
    ZCRMRecord tag = ZCRMRecord.GetInstance("Leads", 538518000449064); //Module API Name, record id
    List<string> tagname = new List<string>() { "N1", "N2" };
    APIResponse response = tag.RemoveTags(tagname);
    ZCRMRecord tags = (ZCRMRecord)response.Data;
    Console.WriteLine(tags.ModuleAPIName);
    Console.WriteLine(tags.EntityId);
    foreach (string tagnames in tags.TagNames)
    {
        Console.WriteLine(tagnames);
    }
    Console.WriteLine(response.Message);
    Console.WriteLine(response.Status);
    Console.WriteLine(response.HttpStatusCode);
    Console.WriteLine(response.ResponseJSON);
}