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

PHP SDK Samples - Module Operations

These sample codes are only applicable for the latest version ( v2.0.0 ) of PHP SDK. Use this link for the previous version samples.

Update Module Settings
              
              
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
    public static function updateModuleSettings()
    {
        $moduleInstance = ZCRMRestClient::getInstance()->getModuleInstance("Leads"); // to get the instance of the module
        $moduleInstance->setPerPage({records_per_page});
        $moduleInstance->setBusinessCardFields(array("buisnessCardFields"));// fields to display on top
        $moduleInstance->setDefaultCustomViewId("{custom_view_id}");//custom view id
        $moduleInstance->setDefaultTerritoryId("{default_territories_id}");//default territory id
        $related_properties_instance=ZCRMRelatedListProperties::getInstance();//instance of zcrmrelatedlistproperties
        $related_properties_instance->setFields(array("Fields"));//fields of the relared list
        $related_properties_instance->setSortBy("{field_api_name}");//field api name to sort by
        $related_properties_instance->setSortOrder("{sortOrder}");//sort order -asc or desc
        $moduleInstance->setRelatedListProperties($related_properties_instance);
        $responseIns = $moduleInstance->updateModuleSettings();
        echo "HTTP Status Code:" . $responseIns->getHttpStatusCode(); // To get update customview http response code
        echo "Status:" . $responseIns->getStatus(); // To get update customview response status
        echo "Message:" . $responseIns->getMessage(); // To get update customview response message
        echo "Code:" . $responseIns->getCode(); // To get update customview status code
        echo "Details:" . json_encode($responseIns->getDetails());   
    }
}
$obj =new Module();
$obj->updateModuleSettings();
 
Fields
Get Field Details
              
              
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
    public function getFieldDetails()
    {
        $moduleIns = ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name"); // To get module instance
        $response = $moduleIns->getFieldDetails("{field_id}"); // to get the field
        $field = $response->getData(); // to get the field data in form of ZCRMField instance.
        echo $field->getApiName(); // to get the field api name
        echo $field->getLength(); // to get the length of the field value
        echo $field->isVisible(); // to check if the field is visible
        echo $field->getFieldLabel(); // to get the field label name
        echo $field->getCreatedSource(); // to get the created source
        echo $field->isMandatory(); // to check if the field is mandatory
        echo $field->getSequenceNumber(); // to get fields sequence number
        echo $field->isReadOnly(); // to check if the field is read only
        echo $field->getDataType(); // to get the field data type
        echo $field->getId(); // to get the field id
        echo $field->isCustomField(); // to check if the field is custom field
        echo $field->isBusinessCardSupported(); // to check if the field is BusinessCard Supported
        echo $field->getDefaultValue(); // to get the default value of the field
        $permissions = $field->getFieldLayoutPermissions(); // get field layout permissions.array of permissions list like CREATE,EDIT,VIEW,QUICK_CREATE etc.
        foreach ($permissions as $permission) { // for each permission
            echo $permission;
        }
        $lookupfield = $field->getLookupField(); // to get the field lookup information
        if ($field->getDataType() == "Lookup") {
            echo $lookupfield->getModule(); // to get the module name of lookupfield
            echo $lookupfield->getDisplayLabel(); // to get the display label of the lookup field
            echo $lookupfield->getId(); // to get the id of the lookup field
        }
        $picklistfieldvalues = $field->getPickListFieldValues(); // to get the pick list values of the field
        foreach ($picklistfieldvalues as $picklistfieldvalue) {
            echo $picklistfieldvalue->getDisplayValue(); // to get display value of the pick list
            echo $picklistfieldvalue->getSequenceNumber(); // to get the sequence number of the pick list
            echo $picklistfieldvalue->getActualValue(); // to get the actual value of the pick list
            echo $picklistfieldvalue->getMaps();
        }
        echo $field->isUniqueField(); // to check if the field is unique
        echo $field->isCaseSensitive(); // to check if the field is case sensitive
        echo $field->isCurrencyField(); // to check if the field is currency field
        echo $field->getPrecision(); // to get the precision of the field
        echo $field->getRoundingOption(); // to get the rounding option of the field
        echo $field->isFormulaField(); // to check if the field is a formula field
        if ($field->isFormulaField()) {
            echo $field->getFormulaReturnType(); // to get the return type of the formula
            echo $field->getFormulaExpression(); // to get the formula expression
        }
        echo $field->isAutoNumberField(); // to check if the field is auto numbering
        if ($field->isAutoNumberField()) {
            echo $field->getPrefix(); // to get the prefix value
            echo $field->getSuffix(); // to get the suffix value
            echo $field->getStartNumber(); // to get the start number
        }
        echo $field->getDecimalPlace(); // to get the decimal place
        echo $field->getJsonType(); // to get the json type of the field
    }
}
$obj =new Module();
$obj->getFieldDetails();
 
Get All Fields
              
              
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
    public function getAllFields()
    {
        $moduleIns = ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}"); // To get module instance
        $response = $moduleIns->getAllFields(); // to get the field
        $fields = $response->getData(); // to get the array of ZCRMField instances
        foreach ($fields as $field) { // each field
            echo $field->getApiName(); // to get the field api name
            echo $field->getLength(); // to get the length of the field value
            echo $field->isVisible(); // to check if the field is visible
            echo $field->getFieldLabel(); // to get the field label name
            echo $field->getCreatedSource(); // to get the created source
            echo $field->isMandatory(); // to check if the field is mandatory
            echo $field->getSequenceNumber(); // to get fields sequence number
            echo $field->isReadOnly(); // to check if the field is read only
            echo $field->getDataType(); // to get the field data type
            echo $field->getId(); // to get the field id
            echo $field->isCustomField(); // to check if the field is custom field
            echo $field->isBusinessCardSupported(); // to check if the field is BusinessCard Supported
            echo $field->getDefaultValue(); // to get the default value of the field
            $permissions = $field->getFieldLayoutPermissions(); // get field layout permissions.array of permissions list like CREATE,EDIT,VIEW,QUICK_CREATE etc.
            foreach ($permissions as $permission) { // for each permission
                echo $permission;
            }
            $lookupfield = $field->getLookupField(); // to get the field lookup information
            if ($field->getDataType() == "Lookup") {
                echo $lookupfield->getModule(); // to get the module name of lookupfield
                echo $lookupfield->getDisplayLabel(); // to get the display label of the lookup field
                echo $lookupfield->getId(); // to get the id of the lookup field
            }
            $picklistfieldvalues = $field->getPickListFieldValues(); // to get the pick list values of the field
            foreach ($picklistfieldvalues as $picklistfieldvalue) {
                echo $picklistfieldvalue->getDisplayValue(); // to get display value of the pick list
                echo $picklistfieldvalue->getSequenceNumber(); // to get the sequence number of the pick list
                echo $picklistfieldvalue->getActualValue(); // to get the actual value of the pick list
                echo $picklistfieldvalue->getMaps();
            }
            echo $field->isUniqueField(); // to check if the field is unique
            echo $field->isCaseSensitive(); // to check if the field is case sensitive
            echo $field->isCurrencyField(); // to check if the field is currency field
            echo $field->getPrecision(); // to get the precision of the field
            echo $field->getRoundingOption(); // to get the rounding option of the field
            echo $field->isFormulaField(); // to check if the field is a formula field
            if ($field->isFormulaField()) {
                echo $field->getFormulaReturnType(); // to get the return type of the formula
                echo $field->getFormulaExpression(); // to get the formula expression
            }
            echo $field->isAutoNumberField(); // to check if the field is auto numbering
            if ($field->isAutoNumberField()) {
                echo $field->getPrefix(); // to get the prefix value
                echo $field->getSuffix(); // to get the suffix value
                echo $field->getStartNumber(); // to get the start number
            }
            echo $field->getDecimalPlace(); // to get the decimal place
            echo $field->getJsonType(); // to get the json type of the field
        }
    }
    
}
$obj =new Module();
$obj->getAllFields();
 
Layouts
Get Layout Details
              
              
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret),"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id};
        ZCRMRestClient::initialize($configuration);
    }
    public function getLayoutDetails()
    {
        $moduleIns = ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}"); // To get module instance
        $response = $moduleIns->getLayoutDetails("3524033000000091055"); // to get the layout
        $layout = $response->getData(); // to get the layout data in form of ZCRMLayout instances
        echo $layout->getId(); // to get the layout id
        echo $layout->getName(); // to get layout name
        echo $layout->getCreatedTime(); // to get the creation time of the layout in iso 8601 format
        echo $layout->getModifiedTime(); // to get the modification time of the layout in iso 8601 format
        echo $layout->isVisible(); // to check if the layout is visible
        $user = $layout->getModifiedBy(); // to get the user details as ZCRMUser instance
        if ($user != null) {
            echo $user->getId(); // to get the id of the user
            echo $user->getName(); // to get the name of the user
        }
        $user = $layout->getCreatedBy(); // to get the user details as ZCRMUser instance
        if ($user != null) {
            echo $user->getId(); // to get the id of the user
            echo $user->getName(); // to get the name of the user
        }
        $profiles = $layout->getAccessibleProfiles(); // to get the accessible profiles details as an array of ZCRMProfile instances
        foreach ($profiles as $profile) { // for each profile
            $profile->getId(); // to get the profile id
            $profile->getName(); // to get the profile name
        }
        echo $layout->getStatus(); // to get the status of the layout
        $sections = $layout->getSections(); // to get the array of sections as ZCRMSection instances
        foreach ($sections as $section) { // for each section
            echo $section->getName(); // to get the section name
            echo $section->getDisplayName(); // to get the display name of the section
            echo $section->getColumnCount(); // to get the column count of the section
            echo $section->getSequenceNumber(); // to get the sequence number of the section
            $fields = $section->getFields(); // to get the array of fields as ZCRMField instances
            foreach ($fields as $field) { // for each field
                echo $field->getApiName(); // to get the field api name
                echo $field->getLength(); // to get the length of the field value
                echo $field->isVisible(); // to check if the field is visible
                echo $field->getFieldLabel(); // to get the field label name
                echo $field->getCreatedSource(); // to get the created source
                echo $field->isMandatory(); // to check if the field is mandatory
                echo $field->getSequenceNumber(); // to get fields sequence number
                echo $field->isReadOnly(); // to check if the field is read only
                echo $field->getDataType(); // to get the field data type
                echo $field->getId(); // to get the field id
                echo $field->isCustomField(); // to check if the field is custom field
                echo $field->isBusinessCardSupported(); // to check if the field is BusinessCard Supported
                echo $field->getDefaultValue(); // to get the default value of the field
                $permissions = $field->getFieldLayoutPermissions(); // get field layout permissions.array of permissions list like CREATE,EDIT,VIEW,QUICK_CREATE etc.
                foreach ($permissions as $permission) { // for each permission
                    echo $permission;
                }
                $lookupfield = $field->getLookupField(); // to get the field lookup information
                if ($lookupfield!=NULL) {
                    echo $lookupfield->getModule(); // to get the module name of lookupfield
                    echo $lookupfield->getDisplayLabel(); // to get the display label of the lookup field
                    echo $lookupfield->getId(); // to get the id of the lookup field
                }
                $picklistfieldvalues = $field->getPickListFieldValues(); // to get the pick list values of the field
                foreach ($picklistfieldvalues as $picklistfieldvalue) {
                    echo $picklistfieldvalue->getDisplayValue(); // to get display value of the pick list
                    echo $picklistfieldvalue->getSequenceNumber(); // to get the sequence number of the pick list
                    echo $picklistfieldvalue->getActualValue(); // to get the actual value of the pick list
                    echo $picklistfieldvalue->getMaps();
                }
                echo $field->isUniqueField(); // to check if the field is unique
                echo $field->isCaseSensitive(); // to check if the field is case sensitive
                echo $field->isCurrencyField(); // to check if the field is currency field
                echo $field->getPrecision(); // to get the precision of the field
                echo $field->getRoundingOption(); // to get the rounding option of the field
                echo $field->isFormulaField(); // to check if the field is a formula field
                if ($field->isFormulaField()) {
                    echo $field->getFormulaReturnType(); // to get the return type of the formula
                    echo $field->getFormulaExpression(); // to get the formula expression
                }
                echo $field->isAutoNumberField(); // to check if the field is auto numbering
                if ($field->isAutoNumberField()) {
                    echo $field->getPrefix(); // to get the prefix value
                    echo $field->getSuffix(); // to get the suffix value
                    echo $field->getStartNumber(); // to get the start number
                }
                echo $field->getDecimalPlace(); // to get the decimal place
                echo $field->getJsonType(); // to get the json type of the field
                $convertmaps = $field->getConvertMapping();
                if($convertmaps!=NULL){
                    foreach ($convertmaps as $key => $value) {
                        echo $key . ":" . $value;
                    }
                }
            }
        }
        $convertmappings = $layout->getConvertMapping(); // to get an convert mapping array
        foreach ($convertmappings as $convertmapping) {
            echo $convertmapping->getName();
            echo $convertmapping->getId();
            $fields = $convertmapping->getFields();
            if ($fields) {
                foreach ($fields as $field) {
                    echo $field->getApiName();
                    echo $field->getId();
                    echo $field->getFieldLabel();
                    echo $field->isRequired();
                }
            }
        }
    }
    
}
$obj =new Module();
$obj->getLayoutDetails();
 
Get All Layouts
          
          
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret),"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id};
        ZCRMRestClient::initialize($configuration);
    }
    public function getAllLayouts()
    {
        $moduleIns = ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}"); // To get module instance
        $response = $moduleIns->getAllLayouts(); // to get all the layout
        $layouts = $response->getData(); // to get the layout data in form of ZCRMLayout instances
        foreach ($layouts as $layout) {
            echo $layout->getId(); // to get the layout id
            echo $layout->getName(); // to get layout name
            echo $layout->getCreatedTime(); // to get the creation time of the layout in iso 8601 format
            echo $layout->getModifiedTime(); // to get the modification time of the layout in iso 8601 format
            echo $layout->isVisible(); // to check if the layout is visible
            $user = $layout->getModifiedBy(); // to get the user details as ZCRMUser instance
            if ($user != NULL) {
                echo $user->getId(); // to get the id of the user
                echo $user->getName(); // to get the name of the user
            }
            $user = $layout->getCreatedBy(); // to get the user details as ZCRMUser instance
            if ($user != NULL) {
                echo $user->getId(); // to get the id of the user
                echo $user->getName(); // to get the name of the user
            }
            $profiles = $layout->getAccessibleProfiles(); // to get the accessible profiles details as an array of ZCRMProfile instances
            foreach ($profiles as $profile) { // for each profile
                $profile->getId(); // to get the profile id
                $profile->getName(); // to get the profile name
            }
            echo $layout->getStatus(); // to get the status of the layout
            $sections = $layout->getSections(); // to get the array of sections as ZCRMSection instances
            foreach ($sections as $section) { // for each section
                echo $section->getName(); // to get the section name
                echo $section->getDisplayName(); // to get the display name of the section
                echo $section->getColumnCount(); // to get the column count of the section
                echo $section->getSequenceNumber(); // to get the sequence number of the section
                $fields = $section->getFields(); // to get the array of fields as ZCRMField instances
                foreach ($fields as $field) { // for each field
                    echo $field->getApiName(); // to get the field api name
                    echo $field->getLength(); // to get the length of the field value
                    echo $field->isVisible(); // to check if the field is visible
                    echo $field->getFieldLabel(); // to get the field label name
                    echo $field->getCreatedSource(); // to get the created source
                    echo $field->isMandatory(); // to check if the field is mandatory
                    echo $field->getSequenceNumber(); // to get fields sequence number
                    echo $field->isReadOnly(); // to check if the field is read only
                    echo $field->getDataType(); // to get the field data type
                    echo $field->getId(); // to get the field id
                    echo $field->isCustomField(); // to check if the field is custom field
                    echo $field->isBusinessCardSupported(); // to check if the field is BusinessCard Supported
                    echo $field->getDefaultValue(); // to get the default value of the field
                    $permissions = $field->getFieldLayoutPermissions(); // get field layout permissions.array of permissions list like CREATE,EDIT,VIEW,QUICK_CREATE etc.
                    foreach ($permissions as $permission) { // for each permission
                        echo $permission; // to display the permissions
                    }
                    $lookupfield = $field->getLookupField(); // to get the field lookup information
                    if ($field->getDataType() == "Lookup") {
                        echo $lookupfield->getModule(); // to get the module name of lookupfield
                        echo $lookupfield->getDisplayLabel(); // to get the display label of the lookup field
                        echo $lookupfield->getId(); // to get the id of the lookup field
                    }
                    $picklistfieldvalues = $field->getPickListFieldValues(); // to get the pick list values of the field
                    foreach ($picklistfieldvalues as $picklistfieldvalue) {
                        echo $picklistfieldvalue->getDisplayValue(); // to get display value of the pick list
                        echo $picklistfieldvalue->getSequenceNumber(); // to get the sequence number of the pick list
                        echo $picklistfieldvalue->getActualValue(); // to get the actual value of the pick list
                        echo $picklistfieldvalue->getMaps();
                    }
                    echo $field->isUniqueField(); // to check if the field is unique
                    echo $field->isCaseSensitive(); // to check if the field is case sensitive
                    echo $field->isCurrencyField(); // to check if the field is currency field
                    echo $field->getPrecision(); // to get the precision of the field
                    echo $field->getRoundingOption(); // to get the rounding option of the field
                    echo $field->isFormulaField(); // to check if the field is a formula field
                    if ($field->isFormulaField()) {
                        echo $field->getFormulaReturnType(); // to get the return type of the formula
                        echo $field->getFormulaExpression(); // to get the formula expression
                    }
                    echo $field->isAutoNumberField(); // to check if the field is auto numbering
                    if ($field->isAutoNumberField()) {
                        echo $field->getPrefix(); // to get the prefix value
                        echo $field->getSuffix(); // to get the suffix value
                        echo $field->getStartNumber(); // to get the start number
                    }
                    echo $field->getDecimalPlace(); // to get the decimal place
                    echo $field->getJsonType(); // to get the json type of the field
                    $convertmaps = $field->getConvertMapping();
                    foreach ($convertmaps as $key => $value) {
                        echo $key . ":" . $value;
                    }
                }
            }
            $convertmappings = $layout->getConvertMapping(); // to get an convert mapping array
            foreach ($convertmappings as $convertmapping) {
                echo $convertmapping->getName();
                echo $convertmapping->getId();
                $fields = $convertmapping->getFields();
                if ($fields) {
                    foreach ($fields as $field) {
                        echo $field->getApiName();
                        echo $field->getId();
                        echo $field->getFieldLabel();
                        echo $field->isRequired();
                    }
                }
            }
        }
    }
    
}
$obj =new Module();
$obj->getAllLayouts();
 
Custom Views
Get Custom View Details
          
          
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
    public function getCustomView()
    {
        $moduleIns = ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}"); // To get module instance
        $response = $moduleIns->getCustomView("{custom_view_id}"); // to get the custom view
        $customView = $response->getData(); // to get the custom view in form of ZCRMCustomView
        echo $customView->getDisplayValue(); // to get the display value of the custom view
        echo $customView->isDefault(); // to check if the custom view is default
        echo $customView->getId(); // to get the id of the custom view
        echo $customView->getName(); // to get the name of the custom view
        echo $customView->getSystemName(); // to get the system name of the custom view
        echo $customView->getSortBy(); // to get the customview Sorted By field Name
        echo $customView->getCategory(); // to get the the category of the custom view
        $fields = $customView->getFields(); // to get the array of fields in custom view
        foreach ($fields as $field) {
            echo $field;
        }
        echo $customView->isFavorite(); // to check if the custom view is favourite
        echo $customView->getSortOrder(); // to get the sort order
        echo $customView->getCriteriaPattern(); // to get the criteria pattern
        $criterias = $customView->getCriteria(); // to get the criteria as a ZCRMCustomViewCriteria instance
        foreach ($criterias as $criteria) {
            echo $criteria->getComparator(); // to get the comparator of the criteria
            echo $criteria->getField(); // to get the field of the criteria
            echo $criteria->getValue(); // to get the value of the criteria
        }
        echo $customView->getModuleAPIName(); // to get the module api name of the custom view
        $categories = $customView->getCategoriesList(); // to get the categories list as an array of ZCRMCustomViewCategory
        foreach ($categories as $category) { //
            echo $category->getDisplayValue(); // to get the display value of the category
            echo $category->getActualValue(); // to get the actual value of the category
        }
        echo $customView->isOffLine(); // to check if the custom view is offline
    }
    
}
$obj =new Module();
$obj->getCustomView();
 
Get All Custom Views
          
          
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require_once __DIR__ . '/../vendor/autoload.php';
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
    public function getAllCustomViews()
    {
        $moduleIns = ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}"); // To get module instance
       /* For VERSION <=2.0.6 
        $response = $moduleIns->getAllCustomViews(); // to get all the custom views*/
        $param_map = array("page"=>"5","per_page"=>"10");//parameters to be passed
        $response = $moduleIns->getAllCustomViews($param_map); // to get all the custom views /$param_map - optional
        $customViews = $response->getData(); // to get the custom view in form of ZCRMCustomView
        foreach ($customViews as $customView) {
            echo $customView->getDisplayValue(); // to get the display value of the custom view
            echo $customView->isDefault(); // to check if the custom view is default
            echo $customView->getId(); // to get the id of the custom view
            echo $customView->getName(); // to get the name of the custom view
            echo $customView->getSystemName(); // to get the system name of the custom view
            echo $customView->getSortBy(); // to get the customview Sorted By field Name
            echo $customView->getCategory(); // to get the the category of the custom view
            
            echo $customView->isFavorite(); // to check if the custom view is favourite
            echo $customView->getSortOrder(); // to get the sort order
            echo $customView->getCriteriaPattern(); // to get the criteria pattern
            $criterias = $customView->getCriteria(); // to get the criteria as a ZCRMCustomViewCriteria instance
            if($criterias!=NULL){
                foreach ($criterias as $criteria) {
                    echo $criteria->getComparator(); // to get the comparator of the criteria
                    echo $criteria->getField(); // to get the field of the criteria
                    echo $criteria->getValue(); // to get the value of the criteria
                }
            }   
            echo $customView->getModuleAPIName(); // to get the module api name of the custom view
             $categories = $customView->getCategoriesList(); // to get the categories list as an array of ZCRMCustomViewCategory
             if($categories!=NULL){
                foreach ($categories as $category) { //
                    echo $category->getDisplayValue(); // to get the display value of the category
                    echo $category->getActualValue(); // to get the actual value of the category
                }
            }
            echo $customView->isOffLine(); // to check if the custom view is offline
        }
    }
    
    
}
$obj =new Module();
$obj->getAllCustomViews();
 
Update Custom View
          
          
<?php
use zcrmsdk\crm\crud\ZCRMCustomView;
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret),"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id};
        ZCRMRestClient::initialize($configuration);
    }
    public function updateCustomView()
    {
        $moduleIns = ZCRMRestClient::getInstance()->getModuleInstance("Leads"); // to get the instance of the module
        $customViewInstance = ZCRMCustomView::getInstance( "{module_api_name}","{custom_view_id}"); // to get the custom view instance
        $customViewInstance->setSortOrder("desc"); // for ascending order
        $customViewInstance->setSortBy("Lead_owner"); // field api names
        $responseIns = $moduleIns->updateCustomView($customViewInstance);
        echo "HTTP Status Code:" . $responseIns->getHttpStatusCode(); // To get update customview http response code
        echo "Status:" . $responseIns->getStatus(); // To get update customview response status
        echo "Message:" . $responseIns->getMessage(); // To get update customview response message
        echo "Code:" . $responseIns->getCode(); // To get update customview status code
        echo "Details:" . json_encode($responseIns->getDetails());
    }
}
$obj =new Module();
$obj->updateCustomView();
 
Related Lists
          
          
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret),"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id};
        ZCRMRestClient::initialize($configuration);
    }
    public function getRelatedListDetails()
    
    {
        $moduleIns = ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}"); // To get module instance
        $response = $moduleIns->getRelatedListDetails("{related_list_id}"); // to get the related list
        $relatedlist = $response->getData(); // to get the related lists as the instance of ZCRMModuleRelatedList
        echo $relatedlist->getApiName(); // to get the api name of the module related list
        echo $relatedlist->getModule(); // to get the module api name to which this module related list is belongs
        echo $relatedlist->getDisplayLabel(); // to get the display Label of the module related list
        echo $relatedlist->isVisible(); // to check whether the module related list is visible
        echo $relatedlist->getName(); // to get name of the module related list
        echo $relatedlist->getId(); // to get id of the module related list
        echo $relatedlist->getHref(); // to get the href of the module related list
        echo $relatedlist->getType(); // to get the type of the module related list
    }
}
$obj =new Module();
$obj->getRelatedListDetails();
 
          
          
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
    public function getAllRelatedLists()
    {
        $moduleIns = ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}"); // To get module instance
        $response = $moduleIns->getAllRelatedLists(); // to get all the related lists
        $relatedlists = $response->getData(); // to get the related lists as the instance of ZCRMModuleRelatedList
        foreach ($relatedlists as $relatedlist) // for eachrelated list
        {
            echo $relatedlist->getApiName(); // to get the api name of the module related list
            echo $relatedlist->getModule(); // to get the module api name to which this module related list is belongs
            echo $relatedlist->getDisplayLabel(); // to get the display Label of the module related list
            echo $relatedlist->isVisible(); // to check whether the module related list is visible
            echo $relatedlist->getName(); // to get name of the module related list
            echo $relatedlist->getId(); // to get id of the module related list
            echo $relatedlist->getHref(); // to get the href of the module related list
            echo $relatedlist->getType(); // to get the type of the module related list
        }
    }
}
$obj =new Module();
$obj->getAllRelatedLists();
 
Records
Get List of Records
          
          
<?php
use zcrmsdk\crm\crud\ZCRMRecord;
use zcrmsdk\crm\exception\ZCRMException;
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
    public function getRecords()
    {
        $moduleIns = ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}"); // To get module instance
        /* For VERSION <=2.0.6 $response = $moduleIns->getRecords(null, null, null, 1, 100, null); // to get the records(parameter - custom_view_id,field_api_name,sort_order,customHeaders is optional and can be given null if not required), customheader is a keyvalue pair for eg("if-modified-since"=>"2008-09-15T15:53:00")*/
        $param_map=array("page"=>10,"per_page"=>10); // key-value pair containing all the parameters - optional
        $header_map = array("if-modified-since"=>"2019-11-15T15:26:49+05:30"); // key-value pair containing all the headers - optional
        $response = $moduleIns->getRecords($param_map,$header_map); // to get the records($param_map - parameter map,$header_map - header map
        $records = $response->getData(); // To get response data
        
        try {
            foreach ($records as $record) {
                echo "\n\n";
                echo $record->getEntityId(); // To get record id
                echo $record->getModuleApiName(); // To get module api name
                echo $record->getLookupLabel(); // To get lookup object name
                $createdBy = $record->getCreatedBy();
                echo $createdBy->getId(); // To get user_id who created the record
                echo $createdBy->getName(); // To get user name who created the record
                $modifiedBy = $record->getModifiedBy();
                echo $modifiedBy->getId(); // To get user_id who modified the record
                echo $modifiedBy->getName(); // To get user name who modified the record
                $owner = $record->getOwner();
                echo $owner->getId(); // To get record owner_id
                echo $owner->getName(); // To get record owner name
                echo $record->getCreatedTime(); // To get record created time
                echo $record->getModifiedTime(); // To get record modified time
                echo $record->getLastActivityTime(); // To get last activity time(latest modify/view time)
                echo $record->getFieldValue("FieldApiName"); // To get particular field value
                $map = $record->getData(); // To get record data as map
                foreach ($map as $key => $value) {
                    if ($value instanceof ZCRMRecord) // If value is ZCRMRecord object
                    {
                        echo $value->getEntityId(); // to get the record id
                        echo $value->getModuleApiName(); // to get the api name of the module
                        echo $value->getLookupLabel(); // to get the lookup label of the record
                    } else // If value is not ZCRMRecord object
                    {
                        echo $key . ":" . $value;
                    }
                }
                /**
                 * Fields which start with "$" are considered to be property fields *
                 */
                echo $record->getProperty('$fieldName'); // To get a particular property value
                $properties = $record->getAllProperties(); // To get record properties as map
                foreach ($properties as $key => $value) {
                    if (is_array($value)) // If value is an array
                    {
                        echo "KEY::" . $key . "=";
                        foreach ($value as $key1 => $value1) {
                            if (is_array($value1)) {
                                foreach ($value1 as $key2 => $value2) {
                                    echo $key2 . ":" . $value2;
                                }
                            } else {
                                echo $key1 . ":" . $value1;
                            }
                        }
                    } else {
                        echo $key . ":" . $value;
                    }
                }
                $layouts = $record->getLayout(); // To get record layout
                echo $layouts->getId(); // To get layout_id
                echo $layouts->getName(); // To get layout name
                
                $taxlists = $record->getTaxList(); // To get the tax list
                foreach ($taxlists as $taxlist) {
                    echo $taxlist->getTaxName(); // To get tax name
                    echo $taxlist->getPercentage(); // To get tax percentage
                    echo $taxlist->getValue(); // To get tax value
                }
                $lineItems = $record->getLineItems(); // To get line_items as map
                foreach ($lineItems as $lineItem) {
                    echo $lineItem->getId(); // To get line_item id
                    echo $lineItem->getListPrice(); // To get line_item list price
                    echo $lineItem->getQuantity(); // To get line_item quantity
                    echo $lineItem->getDescription(); // To get line_item description
                    echo $lineItem->getTotal(); // To get line_item total amount
                    echo $lineItem->getDiscount(); // To get line_item discount
                    echo $lineItem->getDiscountPercentage(); // To get line_item discount percentage
                    echo $lineItem->getTotalAfterDiscount(); // To get line_item amount after discount
                    echo $lineItem->getTaxAmount(); // To get line_item tax amount
                    echo $lineItem->getNetTotal(); // To get line_item net total amount
                    echo $lineItem->getDeleteFlag(); // To get line_item delete flag
                    echo $lineItem->getProduct()->getEntityId(); // To get line_item product's entity id
                    echo $lineItem->getProduct()->getLookupLabel(); // To get line_item product's lookup label
                    $linTaxs = $lineItem->getLineTax(); // To get line_item's line_tax as array
                    foreach ($linTaxs as $lineTax) {
                        echo $lineTax->getTaxName(); // To get line_tax name
                        echo $lineTax->getPercentage(); // To get line_tax percentage
                        echo $lineTax->getValue(); // To get line_tax value
                    }
                }
                $pricedetails = $record->getPriceDetails(); // To get the price_details array
                foreach ($pricedetails as $pricedetail) {
                    echo "\n\n";
                    echo $pricedetail->getId(); // To get the record's price_id
                    echo $pricedetail->getToRange(); // To get the price_detail record's to_range
                    echo $pricedetail->getFromRange(); // To get price_detail record's from_range
                    echo $pricedetail->getDiscount(); // To get price_detail record's discount
                    echo "\n\n";
                }
                $participants = $record->getParticipants(); // To get Event record's participants
                foreach ($participants as $participant) {
                    echo $participant->getName(); // To get the record's participant name
                    echo $participant->getEmail(); // To get the record's participant email
                    echo $participant->getId(); // To get the record's participant id
                    echo $participant->getType(); // To get the record's participant type
                    echo $participant->isInvited(); // To check if the record's participant(s) are invited or not
                    echo $participant->getStatus(); // To get the record's participants' status
                }
               /* End Event  */
               
            }
        } catch (ZCRMException $ex) {
            echo $ex->getMessage(); // To get ZCRMException error message
            echo $ex->getExceptionCode(); // To get ZCRMException error code
            echo $ex->getFile(); // To get the file name that throws the Exception
        }
    }
}
$obj =new Module();
$obj->getRecords();
 
Get a Record
          
          
<{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
    public function getRecord()
    {
        $moduleIns = ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}"); // To get module instance
        $param_map = array("fields"=>"Company,Last_Name"); // key-value pair containing all the params - optional
        $header_map = array("header_name"=>"header_value"); // key-value pair containing all the headers - optional
        $response = $moduleIns->getRecord("{record_id}",$param_map,$header_map); // To get module record
        $record = $response->getData(); // To get response data
        try {
            
            echo "\n\n";
            echo $record->getEntityId(); // To get record id
            echo $record->getModuleApiName(); // To get module api name
            echo $record->getLookupLabel(); // To get lookup object name
            $createdBy = $record->getCreatedBy();
            echo $createdBy->getId(); // To get user_id who created the record
            echo $createdBy->getName(); // To get user name who created the record
            $modifiedBy = $record->getModifiedBy();
            echo $modifiedBy->getId(); // To get user_id who modified the record
            echo $modifiedBy->getName(); // To get user name who modified the record
            $owner = $record->getOwner();
            echo $owner->getId(); // To get record owner_id
            echo $owner->getName(); // To get record owner name
            echo $record->getCreatedTime(); // To get record created time
            echo $record->getModifiedTime(); // To get record modified time
            echo $record->getLastActivityTime(); // To get last activity time(latest modify/view time)
            echo $record->getFieldValue("FieldApiName"); // To get particular field value
            $map = $record->getData(); // To get record data as map
            foreach ($map as $key => $value) {
                if ($value instanceof ZCRMRecord) // If value is ZCRMRecord object
                {
                    echo $value->getEntityId(); // to get the record id
                    echo $value->getModuleApiName(); // to get the api name of the module
                    echo $value->getLookupLabel(); // to get the lookup label of the record
                } else // If value is not ZCRMRecord object
                {
                    echo $key . ":" . $value;
                }
            }
            /**
             * Fields which start with "$" are considered to be property fields *
             */
            echo $record->getProperty('$fieldName'); // To get a particular property value
            $properties = $record->getAllProperties(); // To get record properties as map
            foreach ($properties as $key => $value) {
                if (is_array($value)) // If value is an array
                {
                    echo "KEY::" . $key . "=";
                    foreach ($value as $key1 => $value1) {
                        if (is_array($value1)) {
                            foreach ($value1 as $key2 => $value2) {
                                echo $key2 . ":" . $value2;
                            }
                        } else {
                            echo $key1 . ":" . $value1;
                        }
                    }
                } else {
                    echo $key . ":" . $value;
                }
            }
            $layouts = $record->getLayout(); // To get record layout
            echo $layouts->getId(); // To get layout_id
            echo $layouts->getName(); // To get layout name
            
            $taxlists = $record->getTaxList(); // To get the tax list
            foreach ($taxlists as $taxlist) {
                echo $taxlist->getTaxName(); // To get tax name
                echo $taxlist->getPercentage(); // To get tax percentage
                echo $taxlist->getValue(); // To get tax value
            }
            $lineItems = $record->getLineItems(); // To get line_items as map
            foreach ($lineItems as $lineItem) {
                echo $lineItem->getId(); // To get line_item id
                echo $lineItem->getListPrice(); // To get line_item list price
                echo $lineItem->getQuantity(); // To get line_item quantity
                echo $lineItem->getDescription(); // To get line_item description
                echo $lineItem->getTotal(); // To get line_item total amount
                echo $lineItem->getDiscount(); // To get line_item discount
                echo $lineItem->getDiscountPercentage(); // To get line_item discount percentage
                echo $lineItem->getTotalAfterDiscount(); // To get line_item amount after discount
                echo $lineItem->getTaxAmount(); // To get line_item tax amount
                echo $lineItem->getNetTotal(); // To get line_item net total amount
                echo $lineItem->getDeleteFlag(); // To get line_item delete flag
                echo $lineItem->getProduct()->getEntityId(); // To get line_item product's entity id
                echo $lineItem->getProduct()->getLookupLabel(); // To get line_item product's lookup label
                $linTaxs = $lineItem->getLineTax(); // To get line_item's line_tax as array
                foreach ($linTaxs as $lineTax) {
                    echo $lineTax->getTaxName(); // To get line_tax name
                    echo $lineTax->getPercentage(); // To get line_tax percentage
                    echo $lineTax->getValue(); // To get line_tax value
                }
            }
            $pricedetails = $record->getPriceDetails(); // To get the price_details array
            foreach ($pricedetails as $pricedetail) {
                echo "\n\n";
                echo $pricedetail->getId(); // To get the record's price_id
                echo $pricedetail->getToRange(); // To get the price_detail record's to_range
                echo $pricedetail->getFromRange(); // To get price_detail record's from_range
                echo $pricedetail->getDiscount(); // To get price_detail record's discount
                echo "\n\n";
            }
            $participants = $record->getParticipants(); // To get Event record's participants
            foreach ($participants as $participant) {
                echo $participant->getName(); // To get the record's participant name
                echo $participant->getEmail(); // To get the record's participant email
                echo $participant->getId(); // To get the record's participant id
                echo $participant->getType(); // To get the record's participant type
                echo $participant->isInvited(); // To check if the record's participant(s) are invited or not
                echo $participant->getStatus(); // To get the record's participants' status
            }
            /* End Event */
        } catch (ZCRMException $ex) {
            echo $ex->getMessage(); // To get ZCRMException error message
            echo $ex->getExceptionCode(); // To get ZCRMException error code
            echo $ex->getFile(); // To get the file name that throws the Exception
        }
    }
}
$obj =new Module();
$obj->getRecord();
 
Search Records by Word
          
          
<?php
use zcrmsdk\crm\crud\ZCRMRecord;
use zcrmsdk\crm\exception\ZCRMException;
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
   /* For VERSION <=2.0.6 public function searchRecords() */
   public function searchRecordsByWord()/*the function name has been changed to searchrecordsbyword for sdk version 2.0.7 onwards*/
    {
        $moduleIns = ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}"); // To get module instance
        /* For VERSION <=2.0.6  $searchWord="word_to_search_for";//word to search for
        $page=1;//page number
        $perPage=200;//records per page
        $response = $moduleIns->searchRecords($searchWord, $page , $perPage ); // To get module records// $searchWord word to be searched// $page to get the list of records from the respective pages. Default value for page is 1.// $perPage To get the list of records available per page. Default value for per page is 200.*/
        $searchWord="automated";//word to search for
        $param_map=array("page"=>1,"per_page"=>1); // key-value pair containing all the parameters
        $response = $moduleIns->searchRecordsByWord($searchWord,$param_map) ;// To get module records// $searchWord word to be searched// $param_map-parameters key-value pair - optional
        $records = $response->getData(); // To get response data
        try {
            foreach ($records as $record) {
                echo "\n\n";
                echo $record->getEntityId(); // To get record id
                echo $record->getModuleApiName(); // To get module api name
                echo $record->getLookupLabel(); // To get lookup object name
                $createdBy = $record->getCreatedBy();
                echo $createdBy->getId(); // To get user_id who created the record
                echo $createdBy->getName(); // To get user name who created the record
                $modifiedBy = $record->getModifiedBy();
                echo $modifiedBy->getId(); // To get user_id who modified the record
                echo $modifiedBy->getName(); // To get user name who modified the record
                $owner = $record->getOwner();
                echo $owner->getId(); // To get record owner_id
                echo $owner->getName(); // To get record owner name
                echo $record->getCreatedTime(); // To get record created time
                echo $record->getModifiedTime(); // To get record modified time
                echo $record->getLastActivityTime(); // To get last activity time(latest modify/view time)
                echo $record->getFieldValue("FieldApiName"); // To get particular field value
                $map = $record->getData(); // To get record data as map
                foreach ($map as $key => $value) {
                    if ($value instanceof ZCRMRecord) // If value is ZCRMRecord object
                    {
                        echo $value->getEntityId(); // to get the record id
                        echo $value->getModuleApiName(); // to get the api name of the module
                        echo $value->getLookupLabel(); // to get the lookup label of the record
                    } else // If value is not ZCRMRecord object
                    {
                        echo $key . ":" . $value;
                    }
                }
                /**
                 * Fields which start with "$" are considered to be property fields *
                 */
                echo $record->getProperty('$fieldName'); // To get a particular property value
                $properties = $record->getAllProperties(); // To get record properties as map
                foreach ($properties as $key => $value) {
                    if (is_array($value)) // If value is an array
                    {
                        echo "KEY::" . $key . "=";
                        foreach ($value as $key1 => $value1) {
                            if (is_array($value1)) {
                                foreach ($value1 as $key2 => $value2) {
                                    echo $key2 . ":" . $value2;
                                }
                            } else {
                                echo $key1 . ":" . $value1;
                            }
                        }
                    } else {
                        echo $key . ":" . $value;
                    }
                }
                $layouts = $record->getLayout(); // To get record layout
                /* For VERSION <=2.0.6  echo $layouts->getId(); // To get layout_id*/
                echo $layouts->getId(); // To get layout_id
                echo $layouts->getName(); // To get layout name
                
                $taxlists = $record->getTaxList(); // To get the tax list
                foreach ($taxlists as $taxlist) {
                    echo $taxlist->getTaxName(); // To get tax name
                    echo $taxlist->getPercentage(); // To get tax percentage
                    echo $taxlist->getValue(); // To get tax value
                }
                $lineItems = $record->getLineItems(); // To get line_items as map
                foreach ($lineItems as $lineItem) {
                    echo $lineItem->getId(); // To get line_item id
                    echo $lineItem->getListPrice(); // To get line_item list price
                    echo $lineItem->getQuantity(); // To get line_item quantity
                    echo $lineItem->getDescription(); // To get line_item description
                    echo $lineItem->getTotal(); // To get line_item total amount
                    echo $lineItem->getDiscount(); // To get line_item discount
                    echo $lineItem->getDiscountPercentage(); // To get line_item discount percentage
                    echo $lineItem->getTotalAfterDiscount(); // To get line_item amount after discount
                    echo $lineItem->getTaxAmount(); // To get line_item tax amount
                    echo $lineItem->getNetTotal(); // To get line_item net total amount
                    echo $lineItem->getDeleteFlag(); // To get line_item delete flag
                    echo $lineItem->getProduct()->getEntityId(); // To get line_item product's entity id
                    echo $lineItem->getProduct()->getLookupLabel(); // To get line_item product's lookup label
                    $linTaxs = $lineItem->getLineTax(); // To get line_item's line_tax as array
                    foreach ($linTaxs as $lineTax) {
                        echo $lineTax->getTaxName(); // To get line_tax name
                        echo $lineTax->getPercentage(); // To get line_tax percentage
                        echo $lineTax->getValue(); // To get line_tax value
                    }
                }
                $pricedetails = $record->getPriceDetails(); // To get the price_details array
                foreach ($pricedetails as $pricedetail) {
                    echo "\n\n";
                    echo $pricedetail->getId(); // To get the record's price_id
                    echo $pricedetail->getToRange(); // To get the price_detail record's to_range
                    echo $pricedetail->getFromRange(); // To get price_detail record's from_range
                    echo $pricedetail->getDiscount(); // To get price_detail record's discount
                    echo "\n\n";
                }
                $participants = $record->getParticipants(); // To get Event record's participants
                foreach ($participants as $participant) {
                    echo $participant->getName(); // To get the record's participant name
                    echo $participant->getEmail(); // To get the record's participant email
                    echo $participant->getId(); // To get the record's participant id
                    echo $participant->getType(); // To get the record's participant type
                    echo $participant->isInvited(); // To check if the record's participant(s) are invited or not
                    echo $participant->getStatus(); // To get the record's participants' status
                }
                /* End Event */
            }
        } catch (ZCRMException $ex) {
            echo $ex->getMessage(); // To get ZCRMException error message
            echo $ex->getExceptionCode(); // To get ZCRMException error code
            echo $ex->getFile(); // To get the file name that throws the Exception
        }
    }
}
$obj =new Module();
$obj->searchRecords();
 
Search Records by Phone
          
          
<?php
use zcrmsdk\crm\crud\ZCRMRecord;
use zcrmsdk\crm\exception\ZCRMException;
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
    public function searchRecordsByPhone()
    {
        $moduleIns = ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}"); // To get module instance
        $phone=313213;//phone number to search for
        /*For VERSION searchRecordsByPhone($phone, $page, $perPage); // To get module records// $searchWord word to be searched// $page to get the list of records from the respective pages. Default value for page is 1.// $perPage To get the list of records available per page. Default value for per page is 200.*/
        $param_map=array("page"=>1,"per_page"=>1); // key-value pair containing all the parameters
        $response = $moduleIns->searchRecordsByPhone($phone,$param_map) ;// To get module records// $phone phone to be searched// $param_map-parameters key-value pair - optional
        $records = $response->getData(); // To get response data
        try {
            foreach ($records as $record) {
                echo "\n\n";
                echo $record->getEntityId(); // To get record id
                echo $record->getModuleApiName(); // To get module api name
                echo $record->getLookupLabel(); // To get lookup object name
                $createdBy = $record->getCreatedBy();
                echo $createdBy->getId(); // To get user_id who created the record
                echo $createdBy->getName(); // To get user name who created the record
                $modifiedBy = $record->getModifiedBy();
                echo $modifiedBy->getId(); // To get user_id who modified the record
                echo $modifiedBy->getName(); // To get user name who modified the record
                $owner = $record->getOwner();
                echo $owner->getId(); // To get record owner_id
                echo $owner->getName(); // To get record owner name
                echo $record->getCreatedTime(); // To get record created time
                echo $record->getModifiedTime(); // To get record modified time
                echo $record->getLastActivityTime(); // To get last activity time(latest modify/view time)
                echo $record->getFieldValue("FieldApiName"); // To get particular field value
                $map = $record->getData(); // To get record data as map
                foreach ($map as $key => $value) {
                    if ($value instanceof ZCRMRecord) // If value is ZCRMRecord object
                    {
                        echo $value->getEntityId();
                        echo $value->getModuleApiName();
                        echo $value->getLookupLabel();
                    } else // If value is not ZCRMRecord object
                    {
                        echo $key . ":" . $value;
                    }
                }
                /**
                 * Fields which start with "$" are considered to be property fields *
                 */
                echo $record->getProperty('$fieldName'); // To get a particular property value
                $properties = $record->getAllProperties(); // To get record properties as map
                foreach ($properties as $key => $value) {
                    if (is_array($value)) // If value is an array
                    {
                        echo "KEY::" . $key . "=";
                        foreach ($value as $key1 => $value1) {
                            if (is_array($value1)) {
                                foreach ($value1 as $key2 => $value2) {
                                    echo $key2 . ":" . $value2;
                                }
                            } else {
                                echo $key1 . ":" . $value1;
                            }
                        }
                    } else {
                        echo $key . ":" . $value;
                    }
                }
                $layouts = $record->getLayout(); // To get record layout
                echo $layouts->getId(); // To get layout_id
                echo $layouts->getName(); // To get layout name
                
                $taxlists = $record->getTaxList(); // To get the tax list
                foreach ($taxlists as $taxlist) {
                    echo $taxlist->getTaxName(); // To get tax name
                    echo $taxlist->getPercentage(); // To get tax percentage
                    echo $taxlist->getValue(); // To get tax value
                }
                $lineItems = $record->getLineItems(); // To get line_items as map
                foreach ($lineItems as $lineItem) {
                    echo $lineItem->getId(); // To get line_item id
                    echo $lineItem->getListPrice(); // To get line_item list price
                    echo $lineItem->getQuantity(); // To get line_item quantity
                    echo $lineItem->getDescription(); // To get line_item description
                    echo $lineItem->getTotal(); // To get line_item total amount
                    echo $lineItem->getDiscount(); // To get line_item discount
                    echo $lineItem->getDiscountPercentage(); // To get line_item discount percentage
                    echo $lineItem->getTotalAfterDiscount(); // To get line_item amount after discount
                    echo $lineItem->getTaxAmount(); // To get line_item tax amount
                    echo $lineItem->getNetTotal(); // To get line_item net total amount
                    echo $lineItem->getDeleteFlag(); // To get line_item delete flag
                    echo $lineItem->getProduct()->getEntityId(); // To get line_item product's entity id
                    echo $lineItem->getProduct()->getLookupLabel(); // To get line_item product's lookup label
                    $linTaxs = $lineItem->getLineTax(); // To get line_item's line_tax as array
                    foreach ($linTaxs as $lineTax) {
                        echo $lineTax->getTaxName(); // To get line_tax name
                        echo $lineTax->getPercentage(); // To get line_tax percentage
                        echo $lineTax->getValue(); // To get line_tax value
                    }
                }
                $pricedetails = $record->getPriceDetails(); // To get the price_details array
                foreach ($pricedetails as $pricedetail) {
                    echo "\n\n";
                    echo $pricedetail->getId(); // To get the record's price_id
                    echo $pricedetail->getToRange(); // To get the price_detail record's to_range
                    echo $pricedetail->getFromRange(); // To get price_detail record's from_range
                    echo $pricedetail->getDiscount(); // To get price_detail record's discount
                    echo "\n\n";
                }
                $participants = $record->getParticipants(); // To get Event record's participants
                foreach ($participants as $participant) {
                    echo $participant->getName(); // To get the record's participant name
                    echo $participant->getEmail(); // To get the record's participant email
                    echo $participant->getId(); // To get the record's participant id
                    echo $participant->getType(); // To get the record's participant type
                    echo $participant->isInvited(); // To check if the record's participant(s) are invited or not
                    echo $participant->getStatus(); // To get the record's participants' status
                }
                /* End Event */
            }
        } catch (ZCRMException $ex) {
            echo $ex->getMessage(); // To get ZCRMException error message
            echo $ex->getExceptionCode(); // To get ZCRMException error code
            echo $ex->getFile(); // To get the file name that throws the Exception
        }
    }
}
$obj =new Module();
$obj->searchRecordsByPhone();
 
Search Records by Email
          
          
<?php
use zcrmsdk\crm\crud\ZCRMRecord;
use zcrmsdk\crm\exception\ZCRMException;
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
    public function searchRecordsByEmail()
    {
        $moduleIns = ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}"); // To get module instance
        /* For VERSION <=2.0.6 $email="{email_id}";//email id  to search for
        $page=1;//page number
        $perPage=200;//records per page
        $response = $moduleIns->searchRecordsByEmail($email, $page, $perPage); // To get module records//$searchWord word to be searched//$page to get the list of records from the respective pages. Default value for page is 1.//$perPage To get the list of records available per page. Default value for per page is 200.
        $records = $response->getData(); // To get response data */
        $email="email_id";//email id  to search for
        $param_map=array("page"=>1,"per_page"=>1); // key-value pair containing all the parameters
        try {
            $response = $moduleIns->searchRecordsByEmail($email,$param_map) ;// To get module records// $email email id  to search for// $param_map-parameters key-value pair - optional
            $records = $response->getData(); // To get response data
            foreach ($records as $record) {
                echo "\n\n";
                echo $record->getEntityId(); // To get record id
                echo $record->getModuleApiName(); // To get module api name
                echo $record->getLookupLabel(); // To get lookup object name
                $createdBy = $record->getCreatedBy();
                echo $createdBy->getId(); // To get user_id who created the record
                echo $createdBy->getName(); // To get user name who created the record
                $modifiedBy = $record->getModifiedBy();
                echo $modifiedBy->getId(); // To get user_id who modified the record
                echo $modifiedBy->getName(); // To get user name who modified the record
                $owner = $record->getOwner();
                echo $owner->getId(); // To get record owner_id
                echo $owner->getName(); // To get record owner name
                echo $record->getCreatedTime(); // To get record created time
                echo $record->getModifiedTime(); // To get record modified time
                echo $record->getLastActivityTime(); // To get last activity time(latest modify/view time)
                echo $record->getFieldValue("FieldApiName"); // To get particular field value
                $map = $record->getData(); // To get record data as map
                foreach ($map as $key => $value) {
                    if ($value instanceof ZCRMRecord) // If value is ZCRMRecord object
                    {
                        echo $value->getEntityId();
                        echo $value->getModuleApiName();
                        echo $value->getLookupLabel();
                    } else // If value is not ZCRMRecord object
                    {
                        echo $key . ":" . $value;
                    }
                }
                /**
                 * Fields which start with "$" are considered to be property fields *
                 */
                echo $record->getProperty('$fieldName'); // To get a particular property value
                $properties = $record->getAllProperties(); // To get record properties as map
                foreach ($properties as $key => $value) {
                    if (is_array($value)) // If value is an array
                    {
                        echo "KEY::" . $key . "=";
                        foreach ($value as $key1 => $value1) {
                            if (is_array($value1)) {
                                foreach ($value1 as $key2 => $value2) {
                                    echo $key2 . ":" . $value2;
                                }
                            } else {
                                echo $key1 . ":" . $value1;
                            }
                        }
                    } else {
                        echo $key . ":" . $value;
                    }
                }
                $layouts = $record->getLayout(); // To get record layout
                echo $layouts->getId(); // To get layout_id
                echo $layouts->getName(); // To get layout name
                
                $taxlists = $record->getTaxList(); // To get the tax list
                foreach ($taxlists as $taxlist) {
                    echo $taxlist->getTaxName(); // To get tax name
                    echo $taxlist->getPercentage(); // To get tax percentage
                    echo $taxlist->getValue(); // To get tax value
                }
                $lineItems = $record->getLineItems(); // To get line_items as map
                foreach ($lineItems as $lineItem) {
                    echo $lineItem->getId(); // To get line_item id
                    echo $lineItem->getListPrice(); // To get line_item list price
                    echo $lineItem->getQuantity(); // To get line_item quantity
                    echo $lineItem->getDescription(); // To get line_item description
                    echo $lineItem->getTotal(); // To get line_item total amount
                    echo $lineItem->getDiscount(); // To get line_item discount
                    echo $lineItem->getDiscountPercentage(); // To get line_item discount percentage
                    echo $lineItem->getTotalAfterDiscount(); // To get line_item amount after discount
                    echo $lineItem->getTaxAmount(); // To get line_item tax amount
                    echo $lineItem->getNetTotal(); // To get line_item net total amount
                    echo $lineItem->getDeleteFlag(); // To get line_item delete flag
                    echo $lineItem->getProduct()->getEntityId(); // To get line_item product's entity id
                    echo $lineItem->getProduct()->getLookupLabel(); // To get line_item product's lookup label
                    $linTaxs = $lineItem->getLineTax(); // To get line_item's line_tax as array
                    foreach ($linTaxs as $lineTax) {
                        echo $lineTax->getTaxName(); // To get line_tax name
                        echo $lineTax->getPercentage(); // To get line_tax percentage
                        echo $lineTax->getValue(); // To get line_tax value
                    }
                }
                $pricedetails = $record->getPriceDetails(); // To get the price_details array
                foreach ($pricedetails as $pricedetail) {
                    echo "\n\n";
                    echo $pricedetail->getId(); // To get the record's price_id
                    echo $pricedetail->getToRange(); // To get the price_detail record's to_range
                    echo $pricedetail->getFromRange(); // To get price_detail record's from_range
                    echo $pricedetail->getDiscount(); // To get price_detail record's discount
                    echo "\n\n";
                }
                $participants = $record->getParticipants(); // To get Event record's participants
                foreach ($participants as $participant) {
                    echo $participant->getName(); // To get the record's participant name
                    echo $participant->getEmail(); // To get the record's participant email
                    echo $participant->getId(); // To get the record's participant id
                    echo $participant->getType(); // To get the record's participant type
                    echo $participant->isInvited(); // To check if the record's participant(s) are invited or not
                    echo $participant->getStatus(); // To get the record's participants' status
                }
                /* End Event */
            }
        } catch (ZCRMException $ex) {
            echo $ex->getMessage(); // To get ZCRMException error message
            echo $ex->getExceptionCode(); // To get ZCRMException error code
            echo $ex->getFile(); // To get the file name that throws the Exception
        }
    }
}
$obj =new Module();
$obj->searchRecordsByEmail();
 
Search Records by Criteria
          
          
<?php
use zcrmsdk\crm\crud\ZCRMRecord;
use zcrmsdk\crm\exception\ZCRMException;
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
    public function searchRecordsByCriteria()
    {
        $moduleIns = ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}"); // To get module instance
        $criteria="criteria";//criteria to search for
        /* For VERSION <=2.0.6  $page=5;//page number
        $perPage=200;//records per page
        $response = $moduleIns->searchRecordsByCriteria($criteria, $page, $perPage); // To get module records//string $searchWord word to be searched//number $page to get the list of records from the respective pages. Default value for page is 1.//number $perPage To get the list of records available per page. Default value for per page is 200.*/
         $param_map=array("page"=>1,"per_page"=>1); // key-value pair containing all the parameters
        $response = $moduleIns->searchRecordsByCriteria($criteria,$param_map) ;// To get module records// $criteria to search for  to search for// $param_map-parameters key-value pair - optional
        $records = $response->getData(); // To get response data
        try {
            foreach ($records as $record) {
                echo "\n\n";
                echo $record->getEntityId(); // To get record id
                echo $record->getModuleApiName(); // To get module api name
                echo $record->getLookupLabel(); // To get lookup object name
                $createdBy = $record->getCreatedBy();
                echo $createdBy->getId(); // To get user_id who created the record
                echo $createdBy->getName(); // To get user name who created the record
                $modifiedBy = $record->getModifiedBy();
                echo $modifiedBy->getId(); // To get user_id who modified the record
                echo $modifiedBy->getName(); // To get user name who modified the record
                $owner = $record->getOwner();
                echo $owner->getId(); // To get record owner_id
                echo $owner->getName(); // To get record owner name
                echo $record->getCreatedTime(); // To get record created time
                echo $record->getModifiedTime(); // To get record modified time
                echo $record->getLastActivityTime(); // To get last activity time(latest modify/view time)
                echo $record->getFieldValue("FieldApiName"); // To get particular field value
                $map = $record->getData(); // To get record data as map
                foreach ($map as $key => $value) {
                    if ($value instanceof ZCRMRecord) // If value is ZCRMRecord object
                    {
                        echo $value->getEntityId(); // to get the record id
                        echo $value->getModuleApiName(); // to get the api name of the module
                        echo $value->getLookupLabel(); // to get the lookup label of the record
                    } else // If value is not ZCRMRecord object
                    {
                        echo $key . ":" . $value;
                    }
                }
                /**
                 * Fields which start with "$" are considered to be property fields *
                 */
                echo $record->getProperty('$fieldName'); // To get a particular property value
                $properties = $record->getAllProperties(); // To get record properties as map
                foreach ($properties as $key => $value) {
                    if (is_array($value)) // If value is an array
                    {
                        echo "KEY::" . $key . "=";
                        foreach ($value as $key1 => $value1) {
                            if (is_array($value1)) {
                                foreach ($value1 as $key2 => $value2) {
                                    echo $key2 . ":" . $value2;
                                }
                            } else {
                                echo $key1 . ":" . $value1;
                            }
                        }
                    } else {
                        echo $key . ":" . $value;
                    }
                }
                $layouts = $record->getLayout(); // To get record layout
                echo $layouts->getId(); // To get layout_id
                echo $layouts->getName(); // To get layout name
                
                $taxlists = $record->getTaxList(); // To get the tax list
                foreach ($taxlists as $taxlist) {
                    echo $taxlist->getTaxName(); // To get tax name
                    echo $taxlist->getPercentage(); // To get tax percentage
                    echo $taxlist->getValue(); // To get tax value
                }
                $lineItems = $record->getLineItems(); // To get line_items as map
                foreach ($lineItems as $lineItem) {
                    echo $lineItem->getId(); // To get line_item id
                    echo $lineItem->getListPrice(); // To get line_item list price
                    echo $lineItem->getQuantity(); // To get line_item quantity
                    echo $lineItem->getDescription(); // To get line_item description
                    echo $lineItem->getTotal(); // To get line_item total amount
                    echo $lineItem->getDiscount(); // To get line_item discount
                    echo $lineItem->getDiscountPercentage(); // To get line_item discount percentage
                    echo $lineItem->getTotalAfterDiscount(); // To get line_item amount after discount
                    echo $lineItem->getTaxAmount(); // To get line_item tax amount
                    echo $lineItem->getNetTotal(); // To get line_item net total amount
                    echo $lineItem->getDeleteFlag(); // To get line_item delete flag
                    echo $lineItem->getProduct()->getEntityId(); // To get line_item product's entity id
                    echo $lineItem->getProduct()->getLookupLabel(); // To get line_item product's lookup label
                    $linTaxs = $lineItem->getLineTax(); // To get line_item's line_tax as array
                    foreach ($linTaxs as $lineTax) {
                        echo $lineTax->getTaxName(); // To get line_tax name
                        echo $lineTax->getPercentage(); // To get line_tax percentage
                        echo $lineTax->getValue(); // To get line_tax value
                    }
                }
                $pricedetails = $record->getPriceDetails(); // To get the price_details array
                foreach ($pricedetails as $pricedetail) {
                    echo "\n\n";
                    echo $pricedetail->getId(); // To get the record's price_id
                    echo $pricedetail->getToRange(); // To get the price_detail record's to_range
                    echo $pricedetail->getFromRange(); // To get price_detail record's from_range
                    echo $pricedetail->getDiscount(); // To get price_detail record's discount
                    echo "\n\n";
                }
                $participants = $record->getParticipants(); // To get Event record's participants
                foreach ($participants as $participant) {
                    echo $participant->getName(); // To get the record's participant name
                    echo $participant->getEmail(); // To get the record's participant email
                    echo $participant->getId(); // To get the record's participant id
                    echo $participant->getType(); // To get the record's participant type
                    echo $participant->isInvited(); // To check if the record's participant(s) are invited or not
                    echo $participant->getStatus(); // To get the record's participants' status
                }
                /* End Event */
            }
        } catch (ZCRMException $ex) {
            echo $ex->getMessage(); // To get ZCRMException error message
            echo $ex->getExceptionCode(); // To get ZCRMException error code
            echo $ex->getFile(); // To get the file name that throws the Exception
        }
    }
}
$obj =new Module();
$obj->searchRecordsByCriteria();
 
Mass Update Records
          
          
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
    public function massUpdateRecords()
    {
        $moduleIns = ZCRMRestClient::getInstance()->getModuleInstance("leads"); // to get the instance of the module
        $entityIds = array(
            "{record_id}"
        ); // array of entity ids
        $responseIn = $moduleIns->massUpdateRecords($entityIds, "{field_api_name}", "{value to update}"); // to update the field api name with corresponding field value for the entities
        foreach ($responseIn->getEntityResponses() as $responseIns) {
            echo "HTTP Status Code:" . $responseIn->getHttpStatusCode(); // To get http response code
            echo "Status:" . $responseIns->getStatus(); // To get response status
            echo "Message:" . $responseIns->getMessage(); // To get response message
            echo "Code:" . $responseIns->getCode(); // To get status code
            echo "Details:" . json_encode($responseIns->getDetails());
        }
    }
}
$obj =new Module();
$obj->massUpdateRecords();
 
Update Records
          
          
<?php
use zcrmsdk\crm\crud\ZCRMInventoryLineItem;
use zcrmsdk\crm\crud\ZCRMRecord;
use zcrmsdk\crm\crud\ZCRMTax;
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
    public function updateRecords()
    {
        $moduleIns = ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}"); // to get the instance of the module
        $inventoryRecords = array();
        /**
         * Following methods are being used only by same Inventory only  *
         */
        $record = ZCRMRecord::getInstance("{module_api_name}", "{record_id}"); // to get the instance of the record
        $record->setFieldValue("Subject", "Invoice3"); // This function use to set FieldApiName and value similar to all other FieldApis and Custom field
        $record->setFieldValue("Account_Name", "{account_id}");
        $lineItem = ZCRMInventoryLineItem::getInstance("{line_item_id}"); // To get ZCRMInventoryLineItem instance
        $lineItem->setDescription("Product_description"); // To set line item description
        $lineItem->setDiscount(20); // To set line item discount
        $lineItem->setListPrice(3412); // To set line item list price
        
        $taxInstance1 = ZCRMTax::getInstance("{tax_name}"); // to get the tax instance
        $taxInstance1->setPercentage(20); // to set the tax percentage
        $taxInstance1->setValue(50); // to set the tax value
        $lineItem->addLineTax($taxInstance1); // to add the tax to the line item
        
        $lineItem->setQuantity(101); // To set product quantity to this line item
        $record->addLineItem($lineItem); // to add the line item to the record of invoice
        
        array_push($inventoryRecords, $record); // pushing the record to the array
        
        $record2 = ZCRMRecord::getInstance("{module_api_name}", "{record_id}"); // to get the instance of the record
        $record2->setFieldValue("Subject", "Invoice3"); // This function use to set FieldApiName and value similar to all other FieldApis and Custom field
        $record2->setFieldValue("Account_Name", "{account_id}");
        $lineItem = ZCRMInventoryLineItem::getInstance("{line_item_id}"); // To get ZCRMInventoryLineItem instance
        $lineItem->setDescription("Product_description"); // To set line item description
        $lineItem->setDiscount(20); // To set line item discount
        $lineItem->setListPrice(3412); // To set line item list price
        
        $taxInstance1 = ZCRMTax::getInstance("{tax_name}"); // to get the tax instance
        $taxInstance1->setPercentage(20); // to set the tax percentage
        $taxInstance1->setValue(50); // to set the tax value
        $lineItem->addLineTax($taxInstance1); // to add the tax to the line item
        
        $lineItem->setQuantity(101); // To set product quantity to this line item
        $record2->addLineItem($lineItem); // to add the line item to the record of invoice
        
        array_push($inventoryRecords, $record2); // pushing the record to the array
        
        /**
         * for Price books module only
         */
        $pricebookRecords = array();
        
        $record = ZCRMRecord::getInstance("Price_Books", "price_book_id"); // to get the price book record
        $record->setFieldValue("Pricing_Details", json_decode('[ { "to_range": 5, "discount": 0, "from_range": 1 }, { "to_range": 11, "discount": 1, "from_range": 6 }, { "to_range": 17, "discount": 2, "from_range": 12 }, { "to_range": 23, "discount": 3, "from_range": 18 }, { "to_range": 29, "discount": 4, "from_range": 24 } ]', true)); // setting the discount , range of the pricebook record
        $record->setFieldValue("Pricing_Model", "Flat"); // setting the price book model
        array_push($pricebookRecords, $record); // pushing the record to the array
        
        
        $trigger=array();//triggers to include
        $responseIn = $moduleIns->updateRecords($inventoryRecords,$trigger); // updating the records.$trigger is optional , to update price book records$pricebookRecords can be used in the place of $inventoryRecords
        foreach ($responseIn->getEntityResponses() as $responseIns) {
            echo "HTTP Status Code:" . $responseIn->getHttpStatusCode(); // To get http response code
            echo "Status:" . $responseIns->getStatus(); // To get response status
            echo "Message:" . $responseIns->getMessage(); // To get response message
            echo "Code:" . $responseIns->getCode(); // To get status code
            echo "Details:" . json_encode($responseIns->getDetails());
        }
    }
}
$obj =new Module();
$obj->updateRecords();
 
Upsert Records
          
          
<?php
use zcrmsdk\crm\crud\ZCRMRecord;
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
   
    public function upsertRecords()
    {
        $moduleIns = ZCRMRestClient::getInstance()->getModuleInstance("{Module_api_name"); // to get the instance of the module
        $records = array();
        /**
         * Following methods are being used only by Inventory modules *
         */
        $record = ZCRMRecord::getInstance("{record_id}", null); // to get the instance of the record
        $record->setFieldValue("Company", "Invoisdsddsdce3"); // This function use to set FieldApiName and value similar to all other FieldApis and Custom field
        $record->setFieldValue("Email", "asdsdsdasd@asd.com");
        $record->setFieldValue("Last_Name", "aaddasd");
        
        array_push($records, $record); // pushing the record to the array
        $duplicate_check_fields=array('Company');
        $lar_id="{lar_id}";
        $trigger=array();//trigger to include
        $responseIn = $moduleIns->upsertRecords($records,null,$lar_id,$duplicate_check_fields); // updating the records.
        foreach ($responseIn->getEntityResponses() as $responseIns) {
            echo "HTTP Status Code:" . $responseIn->getHttpStatusCode(); // To get http response code
            echo "Status:" . $responseIns->getStatus(); // To get response status
            echo "Message:" . $responseIns->getMessage(); // To get response message
            echo "Code:" . $responseIns->getCode(); // To get status code
            echo "Details:" . json_encode($responseIns->getDetails());
        }
    }
}
$obj =new Module();
$obj->upsertRecords();
 
Create Records
          
          
<?php
use zcrmsdk\crm\crud\ZCRMInventoryLineItem;
use zcrmsdk\crm\crud\ZCRMRecord;
use zcrmsdk\crm\crud\ZCRMTax;
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
   
    public function createRecords()
    {
        $moduleIns=ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}"); //to get the instance of the module
        $records=array();
        $record=ZCRMRecord::getInstance("{module_api_name}",null);  //To get ZCRMRecord instance
        $record->setFieldValue("Subject","Invoice"); //This function use to set FieldApiName and value similar to all other FieldApis and Custom field
        $record->setFieldValue("Account_Name","{account_id}"); //This function is for Invoices module
        /** Following methods are being used only by Inventory modules **/
        
        $lineItem=ZCRMInventoryLineItem::getInstance(null);  //To get ZCRMInventoryLineItem instance
        $lineItem->setDescription("Product_description");  //To set line item description
        $lineItem ->setDiscount(5);  //To set line item discount
        $lineItem->setListPrice(100);  //To set line item list price
        
        $taxInstance1=ZCRMTax::getInstance("{tax_name}");  //To get ZCRMTax instance
        $taxInstance1->setPercentage(2);  //To set tax percentage
        $taxInstance1->setValue(50);  //To set tax value
        $lineItem->addLineTax($taxInstance1);  //To set line tax to line item
        
        $taxInstance1=ZCRMTax::getInstance("{tax_name}"); //to get the tax instance
        $taxInstance1->setPercentage(12); //to set the tax percentage
        $taxInstance1->setValue(50); //to set the tax value
        $lineItem->addLineTax($taxInstance1); //to add the tax to line item
        
        $lineItem->setProduct(ZCRMRecord::getInstance("{module_api_name}","{record_id}"));  //To set product to line item
        $lineItem->setQuantity(100);  //To set product quantity to this line item
        
        $record->addLineItem($lineItem);   //to add the line item to the record
        
        
        array_push($records, $record); // pushing the record to the array.
        $trigger=array();//triggers to include
        $lar_id={"lead_assignment_rule_id"};//lead assignment rule id
        $responseIn = $moduleIns->createRecords($records,$trigger,$lar_id); // updating the records.$trigger,$lar_id are optional
        foreach ($responseIn->getEntityResponses() as $responseIns) {
            echo "HTTP Status Code:" . $responseIn->getHttpStatusCode(); // To get http response code
            echo "Status:" . $responseIns->getStatus(); // To get response status
            echo "Message:" . $responseIns->getMessage(); // To get response message
            echo "Code:" . $responseIns->getCode(); // To get status code
            echo "Details:" . json_encode($responseIns->getDetails());
        }
    }
}
$obj =new Module();
$obj->createRecords();
 
Delete Records
          
          
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
   
    
    public function deleteRecords()
    {
        $moduleIns = ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}"); // to get the instance of the module
        $recordids = array(
            "{record_id}",
            "{record_id}"
        ); // to create an array of record ids
        $responseIn = $moduleIns->deleteRecords($recordids); // to delete the records
        
        foreach ($responseIn->getEntityResponses() as $responseIns) {
            echo "HTTP Status Code:" . $responseIn->getHttpStatusCode(); // To get http response code
            echo "Status:" . $responseIns->getStatus(); // To get response status
            echo "Message:" . $responseIns->getMessage(); // To get response message
            echo "Code:" . $responseIns->getCode(); // To get status code
            echo "Details:" . json_encode($responseIns->getDetails());
        }
    }
}
$obj =new Module();
$obj->deleteRecords();
 
Get List of Deleted Records
          
          
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
   
    public function getAllDeletedRecords()
    {
        $moduleIns = ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}"); // to get the instance of the module
       /*For VERSION getAllDeletedRecords()->getData(); // to get the trashrecords inform of ZCRMTrashRecord array instances */
       $param_map=array("page"=>"20","per_page"=>"200"); // key-value pair containing all the parameters - optional
        $header_map = array("if-modified-since"=>"2019-11-10T15:26:49+05:30"); // key-value pair containing all the headers - optional
        $trashRecords = $moduleIns->getAllDeletedRecords($param_map,$header_map)->getData(); // to get the trashrecords inform of ZCRMTrashRecord array instances/$param_map - parameter map, $header_map - header_map
        foreach ($trashRecords as $trashrecord) {
            echo $trashrecord->getEntityId(); // to get the entity if of the trash record
            echo $trashrecord->getDisplayName(); // to get the display name if the trash record
        }
    }
}
$obj =new Module();
$obj->getAllDeletedRecords();
 
Get Records from Recycle Bin
          
          
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
   
    public function getRecycleBinRecords()
    {
        $moduleIns = ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}"); // to get the instance of the module
        /* For VERSION <=2.0.6 $trashRecords = $moduleIns->getRecycleBinRecords()->getData(); // to get the trashrecords inform of ZCRMTrashRecord array instances*/
         $param_map=array("page"=>"20","per_page"=>"200"); // key-value pair containing all the parameters - optional
        $header_map = array("if-modified-since"=>"2019-11-10T15:26:49+05:30"); // key-value pair containing all the headers - optional
        $trashRecords = $moduleIns->getRecycleBinRecords($param_map,$header_map)->getData(); // to get the trashrecords inform of ZCRMTrashRecord array instances/$param_map - parameter map, $header_map - header_map
        foreach ($trashRecords as $trashrecord) {
            echo $trashrecord->getEntityId(); // to get the entity if of the trash record
            echo $trashrecord->getDisplayName(); // to get the display name if the trash record
        }
    }
    
}
$obj =new Module();
$obj->getRecycleBinRecords();
 
Get List of Permanently Deleted Records
          
          
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
   
    public function getPermanentlyDeletedRecords()
    {
        $moduleIns = ZCRMRestClient::getInstance()->getModuleInstance("Leads"); // to get the instance of the module
        /* For VERSION <=2.0.6 $trashRecords = $moduleIns->getPermanentlyDeletedRecords()->getData(); // to get the trashrecords inform of ZCRMTrashRecord array instances*/
         $param_map=array("page"=>"20","per_page"=>"200"); // key-value pair containing all the parameters - optional
        $header_map = array("if-modified-since"=>"2019-11-10T15:26:49+05:30"); // key-value pair containing all the headers - optional
        $trashRecords = $moduleIns->getPermanentlyDeletedRecords($param_map,$header_map)->getData(); // to get the trashrecords inform of ZCRMTrashRecord array instances/$param_map - parameter map, $header_map - header_map
        foreach ($trashRecords as $trashrecord) {
            echo $trashrecord->getEntityId(); // to get the entity if of the trash record
            echo $trashrecord->getDisplayName(); // to get the display name if the trash record
        }
    }
    
}
$obj =new Module();
$obj->getPermanentlyDeletedRecords();
 
Tags
Get Tags
          
          
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        $configuration = array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
   
    public static function getTags()
    {
        $moduleIns = ZCRMRestClient::getInstance()->getModuleInstance("Leads"); // to get the instance of the module
        $tags = $moduleIns->getTags()->getData(); // to get the trashrecords inform of ZCRMTag array instances
        foreach($tags as $tag){
            echo $tag->getId();
            echo $tag->getName();
            if( $tag->getCreatedBy()){
                $user= $tag->getCreatedBy();
                echo $user->getId();
                echo $user->getName();
            }
            if( $tag->getModifiedBy()){
                $user= $tag->getModifiedBy();
                echo $user->getId();
                echo $user->getName();
            }
            echo $tag->getCreatedTime();
            echo $tag->getModifiedTime();
            
        }
      }
    }
$obj =new Module();
$obj->getTags();
 
Get Tag Count
          
          
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        $configuration = array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
   
    public function getTagCount()
    {
        $moduleIns = ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}"); // to get the instance of the module
        $tag_count = $moduleIns->getTagCount("{record_id}")
        ->getData()
        ->getCount(); // to get the tag count
        echo $tag_count;
    }
    
}
$obj =new Module();
$obj->getTagCount();
 
Create Tags
          
          
<?php
use zcrmsdk\crm\crud\ZCRMTag;
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
   
    public function createTags()
    {
        $moduleIns = ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}"); // to get the module instance
        $tags = array(); // to create ZCRMTag instances array
        $tag = ZCRMTag::getInstance(); // to get the tag instance
        $tag->setName("test4"); // to set the tag name
        array_push($tags, $tag); // to push the tag to array of ZCRMTag instances
        $responseIn = $moduleIns->createTags($tags); // to create the tags
        foreach ($responseIn->getEntityResponses() as $responseIns) {
            echo "HTTP Status Code:" . $responseIn->getHttpStatusCode(); // To get http response code
            echo "Status:" . $responseIns->getStatus(); // To get response status
            echo "Message:" . $responseIns->getMessage(); // To get response message
            echo "Code:" . $responseIns->getCode(); // To get status code
            echo "Details:" . json_encode($responseIns->getDetails());
        }
    }
    
}
$obj =new Module();
$obj->createTags();
 
Update Tags
          
          
<?php
use zcrmsdk\crm\crud\ZCRMTag;
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
   
    public function updateTags()
    {
        $moduleIns = ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}"); // to get the module instance
        $tags = array(); // to create ZCRMTag instances array
        $tag = ZCRMTag::getInstance("{tag_id}"); // to get the tag instance
        $tag->setName("testnew"); // to set the tag name
        array_push($tags, $tag); // to push the tag to array of ZCRMTag instances
        $tag = ZCRMTag::getInstance("{tag_id}"); // to get the tag instance
        $tag->setName("testnew2"); // to set the tag name
        array_push($tags, $tag); // to push the tag to array of ZCRMTag instances
        $responseIn = $moduleIns->updateTags($tags); // to update the tags
        foreach ($responseIn->getEntityResponses() as $responseIns) {
            echo "HTTP Status Code:" . $responseIn->getHttpStatusCode(); // To get http response code
            echo "Status:" . $responseIns->getStatus(); // To get response status
            echo "Message:" . $responseIns->getMessage(); // To get response message
            echo "Code:" . $responseIns->getCode(); // To get status code
            echo "Details:" . json_encode($responseIns->getDetails());
        }
    }
    
}
$obj =new Module();
$obj->updateTags();
 
Add Tags to Records
          
          
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
   
    public function addTagsToRecords()
    {
        $moduleIns = ZCRMRestClient::getInstance()->getModuleInstance("Leads"); // to get the module instance
        $recordids = array(
            "{record_id}",
        ); // array of record ids from which tags must be added
        $tagnames = array(
            "tea",
            "test2",
            "test3"
        ); // array of tags to be added
        $responseIn = $moduleIns->addTagsToRecords($recordids, $tagnames); // to add the tags to the record
        foreach ($responseIn->getEntityResponses() as $responseIns) {
            echo "HTTP Status Code:" . $responseIn->getHttpStatusCode(); // To get http response code
            echo "Status:" . $responseIns->getStatus(); // To get response status
            echo "Message:" . $responseIns->getMessage(); // To get response message
            echo "Code:" . $responseIns->getCode(); // To get status code
            echo "Details:" . json_encode($responseIns->getDetails());
        }
    }
    
}
$obj =new Module();
$obj->addTagsToRecords();
 
Remove Tags from Records
          
          
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
   
    public function removeTagsFromRecords()
    {
        $moduleIns = ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}"); // to get the module instance
        $recordids = array(
            "{record_id}",
            "{record_id}"
        ); // array of record ids from which tags must be removed
        $tagnames = array(
            "tea",
            "test2",
            "test3"
        ); // array of tags to be removed
        $responseIn = $moduleIns->removeTagsFromRecords($recordids, $tagnames); // to remove the tags from the records
        foreach ($responseIn->getEntityResponses() as $responseIns) {
            echo "HTTP Status Code:" . $responseIn->getHttpStatusCode(); // To get http response code
            echo "Status:" . $responseIns->getStatus();  //To get response status
            echo "Message:".$responseIns->getMessage();  //To get response message
            echo "Code:".$responseIns->getCode();  //To get status code
            echo "Details:".json_encode($responseIns->getDetails());
        }
    }
    
}
$obj =new Module();
$obj->removeTagsFromRecords();