Your use case. Our milestone. The 200th post in our "Kaizen Series: Continuous Improvement for Developer Experience" is coming up. Share Now

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

Recent Launches

New

Easy domain registration, transfer, and secured DNS management.

Try now
New

Payroll software with automated tax payments and filing.

Try now
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

Unified payment solution built for all businesses.

Try now
New

Comprehensive email security and archiving for every business.

Try now
Suites

Cloud-based qualitative data analysis tool.

Try now
New

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

Try now
New

Modern retail POS to sell better, manage your entire business, and join the digital revolution.

Try now
SuitesNew

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

Try now
Suites

Unified platform for customer service and support teams.

Try now

Sales

CRM

Comprehensive CRM platform for customer-facing teams.

CRM
Voice

Cloud Contact Center Software for businesses.

Voice
Sign

Digital signature app for businesses.

Sign
Forms

Build online forms for every business need.

Forms
Bigin

Simple CRM for small businesses moving from spreadsheets.

Bigin
SalesIQ

Live chat app to engage and convert website visitors.

SalesIQ
Bookings

Appointment scheduling app for consultations with customers.

Bookings
RouteIQ

Comprehensive sales map visualization and optimal route planning solution.

RouteIQ
Thrive

Complete loyalty and affiliate management platform.

Thrive
Suites
CRM Plus

Unified platform to deliver top-notch customer experience.

CRM Plus

Marketing

Campaigns

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

Campaigns
Voice

Cloud Contact Center Software for businesses.

Voice
Sign

Digital signature app for businesses.

Sign
Forms

Build online forms for every business need.

Forms
Social

All-in-one social media management software.

Social
Survey

Design surveys to reach and interact with your audience.

Survey
SalesIQ

Live chat app to engage and convert website visitors.

SalesIQ
Sites

Online website builder with extensive customisation options.

Sites
Backstage

End-to-end event management software.

Backstage
PageSense

Website conversion optimization and personalisation platform.

PageSense
Marketing Automation

All-in-one marketing automation software.

Marketing Automation
LandingPage

Smart landing page builder to increase conversion rates

LandingPage
Webinar

Webinar platform for webcasting online webinars.

Webinar
NEW
LeadChain

Sync, manage, and convert leads across channels seamlessly.

LeadChain
NEW
Domains

Easy domain registration, transfer, and secured DNS management.

Domains
NEW
CommunitySpaces

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

CommunitySpaces
Thrive

Complete loyalty and affiliate management platform.

Thrive
Publish

Manage all your local business listings on a single platform.

Publish
Suites
Marketing Plus

Unified marketing platform for marketing teams.

Marketing Plus

Commerce and POS

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
Voice

Cloud Contact Center Software for businesses.

Voice
SalesIQ

Live chat app to engage and convert website visitors.

SalesIQ
Bookings

Appointment scheduling app for consultations with customers.

Bookings
FSM

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

FSM
Lens

Interactive remote assistance software with augmented reality.

Lens
Solo

The all-in-one toolkit for solopreneurs.

Solo
Suites
Service Plus

Unified platform for customer service and support teams.

Service Plus

Finance

Books

Powerful accounting platform for growing businesses.

Books
Expense

Effortless expense reporting platform.

Expense
Sign

Digital signature app for businesses.

Sign
Inventory

Powerful stock management and inventory control software.

Inventory
FREE
Invoice

100% Free invoicing solution.

Invoice
Billing

End-to-end billing solution for your business.

Billing
NEW
Payroll

Payroll software with automated tax payments and filing.

Payroll
Commerce

eCommerce platform to manage and market your online store.

Commerce
Checkout

Collect payments online with custom branded pages.

Checkout
Practice

Practice management software for accounting firms.

Practice
Solo

The all-in-one toolkit for solopreneurs.

Solo
NEW
Payments

Unified payment solution built for all businesses.

Payments
Suites
Finance Plus

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

Finance Plus

Email, Storage, and Collaboration

Mail

Secure email service for teams of all sizes.

Mail
Voice

Cloud Contact Center Software for businesses.

Voice
Sign

Digital signature app for businesses.

Sign
WorkDrive

Online file management for teams.

WorkDrive
Bookings

Appointment scheduling app for consultations with customers.

Bookings
Cliq

Stay in touch with teams no matter where you are.

Cliq
Notebook

Beautiful home for all your notes.

Notebook
Meeting

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

Meeting
Connect

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

Connect
Learn

Knowledge and learning management platform.

Learn
Office Integrator

Built in document editors for web apps.

Office Integrator
Writer

Word processor for focused writing and discussions.

Writer
TeamInbox

Shared inboxes for teams.

TeamInbox
ZeptoMail

Secure and reliable transactional email sending service.

ZeptoMail
Show

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

Show
Tables

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

Tables
Sheet

Spreadsheet software for collaborative teams.

Sheet
Office Suite

Powerful collaborative work platform for teams.

Office Suite
Calendar

Online business calendar to manage events and schedule appointments.

Calendar
ToDo

Collaborative task management for individuals and teams.

ToDo
FREE
PDF Editor

Collaborative online PDF editing tool.

PDF Editor
Suites
Workplace

Application suite built to improve team productivity and collaboration.

Workplace

Human Resources

Expense

Effortless expense reporting platform.

Expense
Recruit

Intuitive recruiting platform built to provide hiring solutions.

Recruit
People

Organize, automate, and simplify your HR processes.

People
Sign

Digital signature app for businesses.

Sign
NEW
Payroll

Payroll software with automated tax payments and filing.

Payroll
Shifts

Employee scheduling and time tracking app.

Shifts
Workerly

Manage temporary staffing with an employee scheduling solution.

Workerly
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
Assist

Remote support and unattended remote access software.

Assist
Vault

Online password manager for teams.

Vault
Directory

Workforce identity and access management solution for cloud businesses.

Directory
Lens

Interactive remote assistance software with augmented reality.

Lens
QEngine

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

QEngine
Catalyst

Pro-code platform to build and deploy your apps.

Catalyst
RPA

Automate manual, tedious, and repetitive tasks easily.

RPA
NEW
eProtect

Comprehensive email security and archiving for every business.

eProtect
FREE
OneAuth

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

OneAuth
Toolkit

Complete resource for any admin-related lookup queries.

Toolkit

BI and Analytics

Analytics

Modern self-service BI and analytics platform.

Analytics
DataPrep

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

DataPrep
NEW
IoT

Harnessing IoT analytics for real-time operational intelligence.

IoT
Embedded BI

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

Embedded BI

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
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
Office Integrator

Built in document editors for web apps.

Office Integrator
DataPrep

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

DataPrep
ZeptoMail

Secure and reliable transactional email sending service.

ZeptoMail
Tables

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

Tables
QEngine

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

QEngine
Catalyst

Pro-code platform to build and deploy your apps.

Catalyst
RPA

Automate manual, tedious, and repetitive tasks easily.

RPA
NEW
IoT

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

IoT
Apptics

Application analytics for all apps.

Apptics
Embedded BI

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

Embedded BI

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 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
Skip to main content

PHP v1 SDK Samples - Module Operations

Fields
Get Field Details
              
              
<?php
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        ZCRMRestClient::initialize();
    }
    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
       
    }
    $_SERVER['user_email_id']="p.boyle@zylker.com";
    $obj =new Module();
    $obj->getFieldDetails();
 
Get All Fields
              
              
<?php
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        ZCRMRestClient::initialize();
    }
    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
        }
    }
    }
    $_SERVER['user_email_id']="p.boyle@zylker.com";
    $obj =new Module();
    $obj->getAllFields();
 
Layouts
Get Layout Details
              
              
<?php
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        ZCRMRestClient::initialize();
    }
    public function getLayoutDetails(){
        $moduleIns=ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}"); //To get module instance
        $response=$moduleIns->getLayoutDetails("{layout_id}"); //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($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();
                }
            }
        }
    }
    $_SERVER['user_email_id']="p.boyle@zylker.com";
    $obj =new Module();
    $obj->getLayoutDetails();
 
Get All Layouts
          
          
<?php
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        ZCRMRestClient::initialize();
    }
    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();
                    }
                }
            }
        }
    }
    $_SERVER['user_email_id']="p.boyle@zylker.com";
    $obj =new Module();
    $obj->getAllLayouts();
 
Custom Views
Get Custom View Details
          
          
<?php
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        ZCRMRestClient::initialize();
    }
    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
    }
    $_SERVER['user_email_id']="p.boyle@zylker.com";
    $obj =new Module();
    $obj->getCustomView();
 
Get All Custom Views
          
          
<?php
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        ZCRMRestClient::initialize();
    }
    public function getAllCustomViews(){
        $moduleIns=ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}"); //To get module instance
        $response=$moduleIns->getAllCustomViews(); //to get all the custom views
        $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
            $fields= $customView->getFields(); //to get the array of fields in custom view
            foreach($fields as $field){
                echo $field; //to display the fields
            }
            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
        }
    }
    $_SERVER['user_email_id']="p.boyle@zylker.com";
    $obj =new Module();
    $obj->getAllCustomViews();
 
Update Custom View
          
          
<?php
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        ZCRMRestClient::initialize();
    }
    public function updateCustomView(){
        $moduleIns=ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}"); //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());
        
    }
    $_SERVER['user_email_id']="p.boyle@zylker.com";
    $obj =new Module();
    $obj->updateCustomView();
 
Related Lists
          
          
<?php
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        ZCRMRestClient::initialize();
    }
    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
    }
    $_SERVER['user_email_id']="p.boyle@zylker.com";
    $obj =new Module();
    $obj->getRelatedListDetails();
 
          
          
<?php
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        ZCRMRestClient::initialize();
    }
    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
        }
    }
    $_SERVER['user_email_id']="p.boyle@zylker.com";
    $obj =new Module();
    $obj->getAllRelatedLists();
 
Records
Get List of Records
          
          
<?php
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        ZCRMRestClient::initialize();
    }
    public function getRecords(){
        $moduleIns=ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}");  //To get module instance
        $response=$moduleIns->getRecords("{custom_view_id}", "{field_api_name(to sort by)}","{sort_order}", {start_index},{end_index},{customHeaders}); //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")
        $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
            
        }
    }
    }
    $_SERVER['user_email_id']="p.boyle@zylker.com";
    $obj =new Module();
    $obj->getRecords();
 
Get a Record
          
          
<?php
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        ZCRMRestClient::initialize();
    }
    public function getRecord(){
        $moduleIns=ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}");  //To get module instance
        $response=$moduleIns->getRecord("{record_id}");  //To get module records
        $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   
        }
    }
    }
    $_SERVER['user_email_id']="p.boyle@zylker.com";
    $obj =new Module();
    $obj->getRecord();
 
Search Records
          
          
<?php
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        ZCRMRestClient::initialize();
    }
    public function searchRecords(){
        $moduleIns=ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}");  //To get module instance
        $response=$moduleIns->searchRecords($searchWord,$page=1,$perPage=200);  //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
        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
            
        }
    }
    }
    $_SERVER['user_email_id']="p.boyle@zylker.com";
    $obj =new Module();
    $obj->searchRecords();
 
Search Records by Phone
          
          
<?php
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        ZCRMRestClient::initialize();
    }
    public function searchRecordsByPhone(){
        $moduleIns=ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}");  //To get module instance
        $response=$moduleIns->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.
        $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
        }
    }
    }
    $_SERVER['user_email_id']="p.boyle@zylker.com";
    $obj =new Module();
    $obj->searchRecordsByPhone();
 
Search Records by Email
          
          
<?php
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        ZCRMRestClient::initialize();
    }
    public function searchRecordsByEmail(){
        $moduleIns=ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}");  //To get module instance
        $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
        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
        }
    }
    }
    $_SERVER['user_email_id']="p.boyle@zylker.com";
    $obj =new Module();
    $obj->searchRecordsByEmail();
 
Search Records by Criteria
          
          
<?php
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        ZCRMRestClient::initialize();
    }
    public function searchRecordsByCriteria(){
        $moduleIns=ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}");  //To get module instance
        $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.
        $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
            
        }
    }
    }$_SERVER['user_email_id']="p.boyle@zylker.com";
    $obj =new Module();
    $obj->searchRecordsByCriteria();
 
Mass Update Records
          
          
<?php
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        ZCRMRestClient::initialize();
    }
    public function massUpdateRecords(){
        $moduleIns=ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}"); //to get the instance of the module
        $entityIds= array("{record_id}"); //array of entity ids
        responseIn=$moduleIns->massUpdateRecords($entityIds,"{field_api_name}","field_value}"); //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());
        }
    }
    }$_SERVER['user_email_id']="p.boyle@zylker.com";
    $obj =new Module();
    $obj->massUpdateRecords();
 
Update Records
          
          
<?php
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        ZCRMRestClient::initialize();
    }
    public function updateRecords(){
        $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("{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($records, $record); //pushing the record to the array
        $record=ZCRMRecord::getInstance("{module_api_name}","{record_id}");
        $record->setFieldValue("Subject","test54");  //This function use to set FieldApiName and value similar to all other FieldApis and Custom field
        $record->setFieldValue("Account_Name","{account_id}");
        
        /** to set the price book details **/
        array_push($records, $record); //pushing the record to the 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($records, $record); //pushing the record to the array
        
        $responseIn=$moduleIns->updateRecords($records); //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());
        }
        
    }
    }$_SERVER['user_email_id']="p.boyle@zylker.com";
    $obj =new Module();
    $obj->updateRecords();
 
Upsert Records
          
          
<?php
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        ZCRMRestClient::initialize();
    }
    public function upsertRecord(){
    $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}", NULL); // 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", NULL); // 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
       
        $responseIn = $moduleIns->upsertRecord($inventoryRecords) // upserting the records.$trigger is optional , to upsert 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());
        }
        
    }
    }$_SERVER['user_email_id']="p.boyle@zylker.com";
    $obj =new Module();
    $obj->upsertRecord();
 
Create Records
          
          
<?php
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        ZCRMRestClient::initialize();
    }
    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 
        $responseIn=$moduleIns->createRecords($records); //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());
        }
        
    }
    }$_SERVER['user_email_id']="p.boyle@zylker.com";
    $obj =new Module();
    $obj->createRecords();
 
Delete Records
          
          
<?php
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        ZCRMRestClient::initialize();
    }
    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());
        }
    }
    }$_SERVER['user_email_id']="p.boyle@zylker.com";
    $obj =new Module();
    $obj->deleteRecords();
 
Get List of Deleted Records
          
          
<?php
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        ZCRMRestClient::initialize();
    }
    public function getAllDeletedRecords(){
        $moduleIns=ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}"); //to get the instance of the module
        $trashRecords=$moduleIns->getAllDeletedRecords()->getData(); //to get the trashrecords inform of ZCRMTrashRecord array instances
        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
        }
    }
    }$_SERVER['user_email_id']="p.boyle@zylker.com";
    $obj =new Module();
    $obj->getAllDeletedRecords();
 
Get Records from Recycle Bin
          
          
<?php
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        ZCRMRestClient::initialize();
    }
    public function getRecycleBinRecords(){
        $moduleIns=ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}"); //to get the instance of the module
        $trashRecords=$moduleIns->getRecycleBinRecords()->getData(); //to get the trashrecords inform of ZCRMTrashRecord array instances
        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
        }
        
    }
    }$_SERVER['user_email_id']="p.boyle@zylker.com";
    $obj =new Module();
    $obj->getRecycleBinRecords();
 
Get List of Permanently Deleted Records
          
          
<?php
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        ZCRMRestClient::initialize();
    }
    public function getPermanentlyDeletedRecords(){
        $moduleIns=ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}"); //to get the instance of the module
        $trashRecords=$moduleIns->getPermanentlyDeletedRecords()->getData(); //to get the trashrecords inform of ZCRMTrashRecord array instances
        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
        }
    }
    }$_SERVER['user_email_id']="p.boyle@zylker.com";
    $obj =new Module();
    $obj->getPermanentlyDeletedRecords();
 
Tags
Get Tags
          
          
<?php
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        ZCRMRestClient::initialize();
    }
    public function getTags() {
        $moduleIns=ZCRMRestClient::getInstance()->getModuleInstance("{module_api_name}"); //to get the instance of the module
        $tags=$moduleIns->getTags()->getData(); //to get the tags of the module in form of ZCRMTag instances array
        foreach ($tags as $tag){
            echo $tag->getid(); //to get the tag id
            echo $tag->getName(); //to get the tag name
        }
    }
    }$_SERVER['user_email_id']="p.boyle@zylker.com";
    $obj =new Module();
    $obj->getTags();
 
Get Tag Count
          
          
<?php
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        ZCRMRestClient::initialize();
    }
    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;
    }
    }$_SERVER['user_email_id']="p.boyle@zylker.com";
    $obj =new Module();
    $obj->getTagCount();
 
Create Tags
          
          
<?php
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        ZCRMRestClient::initialize();
    }
    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());
        }
    }
    }$_SERVER['user_email_id']="p.boyle@zylker.com";
    $obj =new Module();
    $obj->createTags();
 
Update Tags
          
          
<?php
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        ZCRMRestClient::initialize();
    }
    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());
        }
    }
    }$_SERVER['user_email_id']="p.boyle@zylker.com";
    $obj =new Module();
    $obj->updateTags();
 
Add Tags to Records
          
          
<?php
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        ZCRMRestClient::initialize();
    }
    public function addTagsToRecords(){
        $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 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());
          }
    }
    }$_SERVER['user_email_id']="p.boyle@zylker.com";
    $obj =new Module();
    $obj->addTagsToRecords();
 
Remove Tags from Records
          
          
<?php
require 'vendor/autoload.php';
class Module{
    public function __construct()
    {
        ZCRMRestClient::initialize();
    }
    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());
        }
    }
}
    $_SERVER['user_email_id']="p.boyle@zylker.com";
    $obj =new Module();
    $obj->removeTagsFromRecords();