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

Recent Launches

New

Payroll software with automated tax payments and filing.

Try now
New

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

Try for free
New

Low-code IoT platform and solutions for connected businesses.

Try now
New

Business formation service to launch and grow your businesses.

Try now
New

Privacy-friendly application analytics solution.

Try for free
SuitesNew

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

Try now

Sales

 
CRM

Comprehensive CRM platform for customer-facing teams.

CRM
 
Bigin

Simple CRM for small businesses moving from spreadsheets.

Bigin
 
Forms

Build online forms for every business need.

Forms
 
SalesIQ

Live chat app to engage and convert website visitors.

SalesIQ
 
Bookings

Appointment scheduling app for consultations with customers.

Bookings
 
Sign

Digital signature app for businesses.

Sign
 
RouteIQ

Comprehensive sales map visualization and optimal route planning solution.

RouteIQ
 
Thrive

Complete loyalty and affiliate management platform.

Thrive
 
Voice

Cloud Contact Center Software for businesses.

Voice
 
Suites
CRM Plus

Unified platform to deliver top-notch customer experience.

CRM Plus

Marketing

 
Social

All-in-one social media management software.

Social
 
Campaigns

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

Campaigns
 
Forms

Build online forms for every business need.

Forms
 
Survey

Design surveys to reach and interact with your audience.

Survey
 
Sites

Online website builder with extensive customisation options.

Sites
 
PageSense

Website conversion optimization and personalisation platform.

PageSense
 
Backstage

End-to-end event management software.

Backstage
 
Webinar

Webinar platform for webcasting online webinars.

Webinar
 
Marketing Automation

All-in-one marketing automation software.

Marketing Automation
 
LandingPage

Smart landing page builder to increase conversion rates

LandingPage
 
Publish

Manage all your local business listings on a single platform.

Publish
 
SalesIQ

Live chat app to engage and convert website visitors.

SalesIQ
 
Sign

Digital signature app for businesses.

Sign
 
Thrive

Complete loyalty and affiliate management platform.

Thrive
 
Voice

Cloud Contact Center Software for businesses.

Voice
 
NEW
LeadChain

Sync, manage, and convert leads across channels seamlessly.

LeadChain
 
NEW
CommunitySpaces

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

CommunitySpaces
 
Suites
Marketing Plus

Unified marketing platform for marketing teams.

Marketing Plus

Commerce

 
Commerce

eCommerce platform to manage and market your online store.

Commerce

Service

 
Desk

Helpdesk software to deliver great customer support.

Desk
 
Assist

Remote support and unattended remote access software.

Assist
 
Lens

Interactive remote assistance software with augmented reality.

Lens
 
FSM

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

FSM
 
SalesIQ

Live chat app to engage and convert website visitors.

SalesIQ
 
Voice

Cloud Contact Center Software for businesses.

Voice
 
NEW
Solo

The all-in-one toolkit for solopreneurs.

Solo
 
Bookings

Appointment scheduling app for consultations with customers.

Bookings
 
Suites
Service Plus

Unified platform for customer service and support teams.

Service Plus

Finance

 
Books

Powerful accounting platform for growing businesses.

Books
 
FREE
Invoice

100% Free invoicing solution.

Invoice
 
Expense

Effortless expense reporting platform.

Expense
 
Inventory

Powerful stock management and inventory control software.

Inventory
 
Billing

End-to-end billing solution for your business.

Billing
 
Checkout

Collect payments online with custom branded pages.

Checkout
 
NEW
Payroll

Payroll software with automated tax payments and filing.

Payroll
 
NEW
Solo

The all-in-one toolkit for solopreneurs.

Solo
 
Practice

Practice management software for accounting firms.

Practice
 
Sign

Digital signature app for businesses.

Sign
 
Commerce

eCommerce platform to manage and market your online store.

Commerce
 
Suites
Finance Plus

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

Finance Plus

Email and Collaboration

 
Mail

Secure email service for teams of all sizes.

Mail
 
Meeting

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

Meeting
 
Writer

Word processor for focused writing and discussions.

Writer
 
Sheet

Spreadsheet software for collaborative teams.

Sheet
 
Show

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

Show
 
Notebook

Beautiful home for all your notes.

Notebook
 
Cliq

Stay in touch with teams no matter where you are.

Cliq
 
Connect

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

Connect
 
Bookings

Appointment scheduling app for consultations with customers.

Bookings
 
TeamInbox

Shared inboxes for teams.

TeamInbox
 
WorkDrive

Online file management for teams.

WorkDrive
 
Sign

Digital signature app for businesses.

Sign
 
Office Suite

Powerful collaborative work platform for teams.

Office Suite
 
Office Integrator

Built in document editors for web apps.

Office Integrator
 
ZeptoMail

Secure and reliable transactional email sending service.

ZeptoMail
 
Calendar

Online business calendar to manage events and schedule appointments.

Calendar
 
Learn

Knowledge and learning management platform.

Learn
 
Voice

Cloud Contact Center Software for businesses.

Voice
 
ToDo

Collaborative task management for individuals and teams.

ToDo
 
Tables

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

Tables
 
FREE
PDF Editor

Collaborative online PDF editing tool.

PDF Editor
 
Suites
Workplace

Application suite built to improve team productivity and collaboration.

Workplace

Human Resources

 
People

Organize, automate, and simplify your HR processes.

People
 
Recruit

Intuitive recruiting platform built to provide hiring solutions.

Recruit
 
Expense

Effortless expense reporting platform.

Expense
 
Workerly

Manage temporary staffing with an employee scheduling solution.

Workerly
 
NEW
Payroll

Payroll software with automated tax payments and filing.

Payroll
 
Shifts

Employee scheduling and time tracking app.

Shifts
 
Sign

Digital signature app for businesses.

Sign
 
Suites
People Plus

Comprehensive HR platform for seamless employee experiences.

People Plus

Security and IT Management

 
Creator

Build custom apps to simplify business processes.

Creator
 
Directory

Workforce identity and access management solution for cloud businesses.

Directory
 
FREE
OneAuth

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

OneAuth
 
Vault

Online password manager for teams.

Vault
 
Catalyst

Pro-code platform to build and deploy your apps.

Catalyst
 
Toolkit

Complete resource for any admin-related lookup queries.

Toolkit
 
Lens

Interactive remote assistance software with augmented reality.

Lens
 
Assist

Remote support and unattended remote access software.

Assist
 
QEngine

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

QEngine
 
NEW
RPA

Automate manual, tedious, and repetitive tasks easily.

RPA

BI and Analytics

 
Analytics

Modern self-service BI and analytics platform.

Analytics
 
Embedded BI

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

Embedded BI
 
DataPrep

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

DataPrep
 
NEW
IoT

Harnessing IoT analytics for real-time operational intelligence.

IoT

Project Management

 
Projects

Manage, track, and collaborate on projects with teams.

Projects
 
Sprints

Planning and tracking tool for scrum teams.

Sprints
 
BugTracker

Automatic bug tracking software for managing bugs.

BugTracker
 
NEW
Solo

The all-in-one toolkit for solopreneurs.

Solo
 
Suites
Projects Plus

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

Projects Plus

Developer Platforms

 
Creator

Build custom apps to simplify business processes.

Creator
 
Flow

Automate business workflows by creating smart integrations.

Flow
 
Catalyst

Pro-code platform to build and deploy your apps.

Catalyst
 
Office Integrator

Built in document editors for web apps.

Office Integrator
 
ZeptoMail

Secure and reliable transactional email sending service.

ZeptoMail
 
QEngine

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

QEngine
 
Tables

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

Tables
 
NEW
RPA

Automate manual, tedious, and repetitive tasks easily.

RPA
 
NEW
Apptics

Application analytics for all apps.

Apptics
 
Embedded BI

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

Embedded BI
 
NEW
IoT

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

IoT
 
DataPrep

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

DataPrep

IoT

 
NEW
IoT

Low-code IoT platform and solutions for connected businesses.

IoT

Search Result

 
CRM Plus

Unified platform to deliver top-notch customer experience.

Try now
CRM Plus
 
Service Plus

Unified platform for customer service and support teams.

Try now
Service Plus
 
Finance Plus

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

Try now
Finance Plus
 
People Plus

Comprehensive HR platform for seamless employee experiences.

Try now
People Plus
 
Workplace

Application suite built to improve team productivity and collaboration.

Try now
Workplace
 
Marketing Plus

Unified marketing platform for marketing teams.

Try now
Marketing Plus
 
Projects Plus

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

Try now
Projects Plus
 
All-in-one suite

Zoho One

The Operating System for Business

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

TRY ZOHO ONE
Zoho One
Zoho Marketplace

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

EXPLORE MARKETPLACE
Marketplace
Skip to main content

PHP SDK Samples - Record Operations

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

Create a Record
          
          
<?php
use zcrmsdk\crm\crud\ZCRMInventoryLineItem;
use zcrmsdk\crm\crud\ZCRMRecord;
use zcrmsdk\crm\crud\ZCRMTax;
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Record{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
   
    public function create()
    {
        $record = ZCRMRestClient::getInstance()->getRecordInstance("{module_api_name}", "{record_id}"); // To get record instance
        $record->setFieldValue("Subject", "test2312"); // This function use to set FieldApiName and value similar to all other FieldApis and Custom field
        $record->setFieldValue("Account_Name", "3524033000001052013"); // Account Name can be given for a new account, account_id is not mandatory in that case
        /**
         * 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("org"); // 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("org");
        $taxInstance1->setPercentage(12);
        $taxInstance1->setValue(50);
        $lineItem->addLineTax($taxInstance1);
        
        $lineItem->setProduct(ZCRMRecord::getInstance("Products", "{product_id}")); // To set product to line item
        $lineItem->setQuantity(100); // To set product quantity to this line item
        
        $record->addLineItem($lineItem);
        $trigger=array();//triggers to include
        $lar_id="{lar_id}";//lead assignment rule id
        $responseIns = $record->create($trigger,$lar_id);//$trigger , $larid optional
        echo "HTTP Status Code:" . $responseIns->getHttpStatusCode(); // To get http response code
        echo "Status:" . $responseIns->getStatus(); // To get response status
        echo "Message:" . $responseIns->getMessage(); // To get response message
        echo "Code:" . $responseIns->getCode(); // To get status code
        echo "Details:" . json_encode($responseIns->getDetails());
    }
    
}
$obj =new Record();
$obj->create();
 
Update a Record
          
          
<?php
use zcrmsdk\crm\crud\ZCRMInventoryLineItem;
use zcrmsdk\crm\crud\ZCRMTax;
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Record{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
   
    public function update()
    {
        $record = ZCRMRestClient::getInstance()->getRecordInstance("{module_api_name}", "{record_id}"); // To get record instance
        /**
         * only for inventory module *
         */
        $record->setFieldValue("Subject", "test2312"); // This function use to set FieldApiName and value similar to all other FieldApis and Custom field
        $record->setFieldValue("Account_Name", "{account_id}"); // Account Name can be given for a new account, account_id is not mandatory in that case
        $lineItem = ZCRMInventoryLineItem::getInstance("{line_item_id}"); // To get ZCRMInventoryLineItem instance the id of the line item
        $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
        /**
         * for price book alone
         * $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*
         */
        $trigger=array();//triggers to include
        $lar_id="lar_id";//lead assignment rule id
        $responseIns = $record->update($trigger,$lar_id); // to update the record
        
        echo "HTTP Status Code:" . $responseIns->getHttpStatusCode(); // To get http response code
        echo "Status:" . $responseIns->getStatus(); // To get response status
        echo "Message:" . $responseIns->getMessage(); // To get response message
        echo "Code:" . $responseIns->getCode(); // To get status code
        echo "Details:" . json_encode($responseIns->getDetails());
    }
    
}
$obj =new Record();
$obj->update();
 
Delete a Record
          
          
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Record{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
   
    public function delete()
    {
        $record = ZCRMRestClient::getInstance()->getRecordInstance("{module_api_name}", "{record_id}"); // To get record instance
        $responseIns = $record->delete();
        
        echo "HTTP Status Code:" . $responseIns->getHttpStatusCode(); // To get http response code
        echo "Status:" . $responseIns->getStatus(); // To get response status
        echo "Message:" . $responseIns->getMessage(); // To get response message
        echo "Code:" . $responseIns->getCode(); // To get status code
        echo "Details:" . json_encode($responseIns->getDetails());
    }
    
}
$obj =new Record();
$obj->delete();
 
Convert a Record
          
          
<?php
use zcrmsdk\crm\crud\ZCRMRecord;
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Record{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
   
    public function convert()
    {
        $record = ZCRMRestClient::getInstance()->getRecordInstance("Leads", "{lead_id}"); // To get record instance
        $deal = ZCRMRecord::getInstance("deals", Null); // to get the record of deal in form of ZCRMRecord insatnce
        $deal->setFieldValue("Deal_Name", "test3"); // to set the deal name
        $deal->setFieldValue("Stage", "Qualification"); // to set the stage
        $deal->setFieldValue("Closing_Date", "2016-03-30"); // to set the closing date
        $details = array("overwrite"=>TRUE,"notify_lead_owner"=>TRUE,"notify_new_entity_owner"=>TRUE,"Accounts"=>"{account_id}","Contacts"=>"{contact_id}","assign_to"=>"{user_id}");
        $responseIn = $record->convert($deal, $details); // to convert record
        echo "HTTP Status Code:" . $responseIn->getHttpStatusCode(); // To get http response code
        echo "Status:" . $responseIn->getStatus(); // To get response status
        echo "Message:" . $responseIn->getMessage(); // To get response message
        echo "Code:" . $responseIn->getCode(); // To get status code
        echo "Details:" . json_encode($responseIn->getDetails());
    }
    
}
$obj =new Record();
$obj->convert();
 
          
          
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Record{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
   
    public function getRelatedListRecords()
    {
        $record = ZCRMRestClient::getInstance()->getRecordInstance("{module_api_name}", "{record_id}"); // To get record instance
        /* For VERSION <=2.0.6 $relatedlistrecords = $record->getRelatedListRecords("Attachments")->getData(); // to get the related list records in form of ZCRMRecord instance*/
        
        $param_map=array("page"=>"1","per_page"=>"200"); // key-value pair containing all the parameters - optional
        $header_map = array("if-modified-since"=>"2019-10-10T15:26:49+05:30"); // key-value pair containing all the headers - optional
        $relatedlistrecords = $record->getRelatedListRecords("Attachments",$param_map,$header_map)->getData(); // to get the related list records in form of ZCRMRecord instance
        
        foreach ($relatedlistrecords as $relatedlistrecord) {
            echo $relatedlistrecord->getEntityId(); // to get the entity id
            echo $relatedlistrecord->getFieldValue("File_Name"); // to get the file name
            echo $relatedlistrecord->getModuleApiName(); // to get the api name of the module
        }
        $relatedlistrecords = $record->getRelatedListRecords("Products")->getData(); // to get the related list record inform of ZCRMRecord instance
        foreach ($relatedlistrecords as $relatedlistrecord) {
            echo $relatedlistrecord->getModuleApiName(); // to get the api name of the module
            echo $relatedlistrecord->getFieldValue("Product_Name"); // to get the product name
            echo $relatedlistrecord->getEntityId(); // to get the entity id
            echo $relatedlistrecord->getFieldValue("Product_Code"); // to get the product code
        }
        $relatedlistrecords = $record->getRelatedListRecords("Activities")->getData(); // to get the related list record inform of ZCRMRecord instance
        foreach ($relatedlistrecords as $relatedlistrecord) {
            echo $relatedlistrecord->getModuleApiName(); // to get the api name of the module
            echo $relatedlistrecord->getEntityId(); // to get the entity id
            echo $relatedlistrecord->getFieldValue("Subject"); // to get the subject of the activity
            echo $relatedlistrecord->getFieldValue("Due_Date"); // to get the due date of the activity
            echo $relatedlistrecord->getFieldValue("Billable"); // to get the billable value
            echo $relatedlistrecord->getFieldValue("Activity_Type"); // to get the activity type
        }
        $relatedlistrecords = $record->getRelatedListRecords("Campaigns")->getData(); // to get the related list record inform of ZCRMRecord instance
        foreach ($relatedlistrecords as $relatedlistrecord) {
            echo $relatedlistrecord->getModuleApiName(); // to get the api name of the module
            echo $relatedlistrecord->getEntityId(); // to get the entity id
            echo $relatedlistrecord->getFieldValue("Campaign_Name"); // to get the campaigns name
            echo $relatedlistrecord->getFieldValue("Description"); // to get the campaign's description
            echo $relatedlistrecord->getFieldValue("Member_Status"); // to get the member status
        }
        $relatedlistrecords = $record->getRelatedListRecords("Quotes")->getData(); // to get the related list record inform of ZCRMRecord instance
        
        foreach ($relatedlistrecords as $relatedlistrecord) {
            echo $relatedlistrecord->getModuleApiName(); // to get the api name of the module
            echo $relatedlistrecord->getEntityId(); // to get the entity id
            echo $relatedlistrecord->getFieldValue("Carrier"); // to get the carrier
            echo $relatedlistrecord->getFieldValue("Quote_Stage"); // to get the quote stage
            echo $relatedlistrecord->getFieldValue("Subject"); // to get the quote subject
            echo $relatedlistrecord->getFieldValue("Quote_Number"); // to get the quote number
            echo $relatedlistrecord->getFieldValue("currency_symbol"); // to get the currency symbol
        }
        $relatedlistrecords = $record->getRelatedListRecords("SalesOrders")->getData(); // to get the related list record inform of ZCRMRecord instance
        
        foreach ($relatedlistrecords as $relatedlistrecord) {
            echo $relatedlistrecord->getModuleApiName(); // to get the api name of the module
            echo $relatedlistrecord->getEntityId(); // to get the entity id
            echo $relatedlistrecord->getFieldValue("Carrier"); // to get the carrier
            echo $relatedlistrecord->getFieldValue("Status"); // to get the status of the sales order
            echo $relatedlistrecord->getFieldValue("Billing_Street"); // to get the billing street
            echo $relatedlistrecord->getFieldValue("Billing_Code"); // to get the billing code
            echo $relatedlistrecord->getFieldValue("Subject"); // to get the subject
            echo $relatedlistrecord->getFieldValue("Billing_City"); // to get the billing city
            echo $relatedlistrecord->getFieldValue("SO_Number"); // to get the sales order number
            echo $relatedlistrecord->getFieldValue("Billing_State"); // to get the billing state
        }
        $relatedlistrecords = $record->getRelatedListRecords("Cases")->getData(); // to get the related list record inform of ZCRMRecord instance
        foreach ($relatedlistrecords as $relatedlistrecord) {
            echo $relatedlistrecord->getModuleApiName(); // to get the api name of the module
            echo $relatedlistrecord->getEntityId(); // to get the entity id
            echo $relatedlistrecord->getFieldValue("Status"); // to get the status of the case
            echo $relatedlistrecord->getFieldValue("Email"); // to get the email id
            echo $relatedlistrecord->getFieldValue("Case_Origin"); // to get the case origin
            echo $relatedlistrecord->getFieldValue("Case_Number"); // to get the case number
        }
    }
    
}
$obj =new Record();
$obj->getRelatedListRecords();
 
Add Line items to Records
          
          
<?php
use zcrmsdk\crm\crud\ZCRMInventoryLineItem;
use zcrmsdk\crm\crud\ZCRMRecord;
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Record{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
   
    public function addLineItemToExistingRecord() //this function costs 2 API credits.
    {
        $record = ZCRMRestClient::getInstance()->getRecordInstance("{module_api_name}", "{record_id}"); // To get record instance
        
        $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
        $lineItem->setProduct(ZCRMRecord::getInstance("Products", "{product_id}")); // To set product to line item
        $lineItem->setQuantity(100); //
        $responseIns = $record->addLineItemtoExistingRecord($lineItem);
        echo "HTTP Status Code:" . $responseIns->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:" . $responseIns->getDetails()['id'];
    }
    
}
$obj =new Record();
$obj->addLineItemToExistingRecord();
          
Update Line items of Records
          
          
<?php
use zcrmsdk\crm\crud\ZCRMInventoryLineItem;
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Record{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
   
    public function updateLineItemofTheExistingRecord() //this function costs 2 API credits.
    {
        $record = ZCRMRestClient::getInstance()->getRecordInstance("{module_api_name}", "{record_id}");// To get record instance
        
        $lineItem = ZCRMInventoryLineItem::getInstance(null); // To get ZCRMInventoryLineItem instance
        $lineItem->setId("3524033000001325006");
        $lineItem->setDescription("Product_ssdsdcription"); // To set line item description
        $lineItem->setDiscount(5); // To set line item discount
        $lineItem->setListPrice(12312); // To set line item list price
        $lineItem->setQuantity(100); //
        $responseIns = $record->updateLineItemofTheExistingRecord($lineItem);
        echo "HTTP Status Code:" . $responseIns->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:" . $responseIns->getDetails()['id'];
    }
    
}
$obj =new Record();
$obj->updateLineItemofTheExistingRecord();
          
Delete Line items from Records
          
          
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Record{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
   
    public function deleteLineItemFromTheExistingRecord() //this function costs 2 API credits.
    {
        $record = ZCRMRestClient::getInstance()->getRecordInstance("{module_api_name}", "{record_id}"); // To get record instance
        $responseIns = $record->deleteLineItemFromTheExistingRecord("{line_item_id}");
        echo "HTTP Status Code:" . $responseIns->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:" . $responseIns->getDetails()['id'];
    }
    
}
$obj =new Record();
$obj->deleteLineItemFromTheExistingRecord();
          
Notes in a Record
Get Notes
          
          
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Record{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
   
    public function getNotes()
    {
        $record = ZCRMRestClient::getInstance()->getRecordInstance("{module_api_name}", "{record_id}"); // To get record instance
        /* For VERSION <=2.0.6 $notes = $record->getNotes()->getData(); // to get the notes in form of ZCRMNote instances array */
         $param_map=array("page"=>"1","per_page"=>"200"); // key-value pair containing all the parameters - optional
        $header_map = array("if-modified-since"=>"2019-12-12T15:26:49+05:30"); // key-value pair containing all the headers - optional
        $notes = $record->getNotes($param_map,$header_map)->getData(); // to get the notes in form of ZCRMNote instances array
        foreach ($notes as $note) {
            
            echo "\n";
            echo $note->getId(); // To get note id
            echo $note->getTitle(); // To get note title
            echo $note->getContent(); // To get note content
            $parentRecord = $note->getParentRecord(); // To get note's parent record
            echo $parentRecord->getEntityId(); // To get note's parent record id
            echo $note->getParentName(); // To get note's parent name
            echo $note->getParentId(); // To get note's parent id
            $createdBy = $note->getCreatedBy();
            echo $createdBy->getId(); // To get user_id who created the note
            echo $createdBy->getName(); // To get user name who created the note
            $modifiedBy = $note->getModifiedBy();
            echo $modifiedBy->getId(); // To get user_id who modified the note
            echo $modifiedBy->getName(); // To get user name who modified the note
            $owner = $note->getOwner();
            echo $owner->getId(); // To get note_record owner id
            echo $owner->getName(); // To get note_record Owner name
            echo $note->getCreatedTime(); // To get created time of the note
            echo $note->getModifiedTime(); // To get modified time of the note
            echo $note->isVoiceNote(); // Check if the note is voice_note or not
            echo $note->getSize(); // To get note_record size
            $attchments = $note->getAttachments(); // To get attachments of the note_record
            if ($attchments != null) // check If attachments is empty/not
            {
                foreach ($attchments as $attchmentIns) {
                    echo $attchmentIns->getId(); // To get the note's attachment id
                    echo $attchmentIns->getFileName(); // To get the note's attachment file name
                    echo $attchmentIns->getFileType(); // To get the note's attachment file type
                    echo $attchmentIns->getSize(); // To get the note's attachment file size
                    echo $attchmentIns->getParentModule(); // To get the note's attachment parent module name
                    $parentRecord = $attchmentIns->getParentRecord();
                    echo $parentRecord->getEntityId(); // To get the note's parent record id
                    echo $attchmentIns->getParentName(); // To get the note name
                    echo $attchmentIns->getParentId(); // To get the note id
                    $createdBy = $attchmentIns->getCreatedBy();
                    echo $createdBy->getId(); // To get user_id who created the note's attachment
                    echo $createdBy->getName(); // To get user name who created the note's attachment
                    $modifiedBy = $attchmentIns->getModifiedBy();
                    echo $modifiedBy->getId(); // To get user_id who modified the note's attachment
                    echo $modifiedBy->getName(); // To get user name who modified the note's attachment
                    $owner = $attchmentIns->getOwner();
                    echo $owner->getId(); // To get the note's attachment owner id
                    echo $owner->getName(); // To get the note's attachment owner name
                    echo $attchmentIns->getCreatedTime(); // To get attachment created time
                    echo $attchmentIns->getModifiedTime(); // To get attachment modified time
                }
            }
        }
    }
}
$obj =new Record();
$obj->getNotes();
 
Add Notes
          
          
use zcrmsdk\crm\crud\ZCRMNote;
use zcrmsdk\crm\crud\ZCRMRecord;
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Record{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
 
public function addNotes(){
        $record = ZCRMRecord::getInstance("Accounts", "3524033000003350015");
        $noteIns = ZCRMNote::getInstance($record, NULL); // to get the note instance
        $noteIns->setTitle("Title_API1"); // to set the note title
        $noteIns->setContent("This is test content"); // to set the note content
        $noteIns1 = ZCRMNote::getInstance($record, NULL); // to get another note instance
        $noteIns1->setTitle("Title_API1"); // to set the note title
        $noteIns1->setContent("This is test content1");
        $noteInstances=[$noteIns,$noteIns1];
        $responseIn=$record->addNotes($noteInstances);
        foreach ($responseIn->getEntityResponses() as $responseIns) {
            echo "HTTP Status Code:" . $responseIn->getHttpStatusCode(); // To get http response code
            echo "Status:" . $responseIns->getStatus(); // To get response status
            echo "Message:" . $responseIns->getMessage(); // To get response message
            echo "Code:" . $responseIns->getCode(); // To get status code
            echo "Details:" . json_encode($responseIns->getDetails());
        }
    }
$obj =new Record();
$obj->addNotes();
 
Add a Note
          
          
<?php
use zcrmsdk\crm\crud\ZCRMNote;
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Record{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
   
    public function addNote()
    {
        $record = ZCRMRestClient::getInstance()->getRecordInstance("{module_api_name}", "{record_id}"); // To get record instance
        $noteIns = ZCRMNote::getInstance($record, null); // to get the note instance
        $noteIns->setTitle("Title_API1"); // to set the note title
        $noteIns->setContent("This is test content"); // to set the note content
        $responseIns = $record->addNote($noteIns); // to add the note
        
        echo "HTTP Status Code:" . $responseIns->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:" . $responseIns->getDetails()['id'];
    }
}
$obj =new Record();
$obj->addNote();
 
Update a Note
          
          
<?php
use zcrmsdk\crm\crud\ZCRMNote;
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Record{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
   
    public function updateNote()
    {
        $record = ZCRMRestClient::getInstance()->getRecordInstance("{moduel_api_name}", "{record_id}"); // To get record instance
        $noteIns = ZCRMNote::getInstance($record, "{note_id}"); // to get the note instance
        $noteIns->setTitle("Title_API1"); // to set the title of the note
        $noteIns->setContent("This is test cooontent"); // to set the content of the note
        $responseIns = $record->updateNote($noteIns); // to update the note
        echo "HTTP Status Code:" . $responseIns->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:" . $responseIns->getDetails()['id'];
    }
}
$obj =new Record();
$obj->updateNote();
 
Delete a Note
          
          
<?php
use zcrmsdk\crm\crud\ZCRMNote;
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Record{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
   
    public function deleteNote()
    {
        $record = ZCRMRestClient::getInstance()->getRecordInstance("{module_api_name}", "{record_id}"); // To get record instance
        $noteIns = ZCRMNote::getInstance($record, "{note_id}"); // to get the note instance
        $responseIns = $record->deleteNote($noteIns); // to delete the note
        
        echo "HTTP Status Code:" . $responseIns->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:" . $responseIns->getDetails()['id'];
    }
}
$obj =new Record();
$obj->deleteNote();
 
Attachments in a Record
Get Attachments
          
          
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Record{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
   
    public function getAttachments()
    {
        /* For VERSION <=2.0.6 $records = ZCRMRestClient::getInstance()->getRecordInstance("{module_api_name}", "{record_id}"); // To get record instance
        $responseIns = $records->getAttachments(1, 50); // to get the attachments */
        $record = ZCRMRestClient::getInstance()->getRecordInstance("{module_api_name}", "{record_id}"); // To get record instance
        $param_map=array("page"=>"1","per_page"=>"200"); // key-value pair containing all the parameters - optional
        $header_map = array("if-modified-since"=>"2019-12-12T15:26:49+05:30"); // key-value pair containing all the headers - optional
        $responseIns = $record->getAttachments($param_map, $header_map); // to get the attachments
        $attachments = $responseIns->getData(); // to get the attachments in form of ZCRMAttachment instance array
        foreach ($attachments as $attchmentIns) {
            echo $attchmentIns->getId(); // To get the note's attachment id
            echo $attchmentIns->getFileName(); // To get the note's attachment file name
            echo $attchmentIns->getFileType(); // To get the note's attachment file type
            echo $attchmentIns->getSize(); // To get the note's attachment file size
            echo $attchmentIns->getParentModule(); // To get the note's attachment parent module name
            $parentRecord = $attchmentIns->getParentRecord();
            echo $parentRecord->getEntityId(); // To get the note's parent record id
            echo $attchmentIns->getParentName(); // To get the note name
            echo $attchmentIns->getParentId(); // To get the note id
            $createdBy = $attchmentIns->getCreatedBy();
            echo $createdBy->getId(); // To get user_id who created the note's attachment
            echo $createdBy->getName(); // To get user name who created the note's attachment
            $modifiedBy = $attchmentIns->getModifiedBy();
            echo $modifiedBy->getId(); // To get user_id who modified the note's attachment
            echo $modifiedBy->getName(); // To get user name who modified the note's attachment
            $owner = $attchmentIns->getOwner();
            echo $owner->getId(); // To get the note's attachment owner id
            echo $owner->getName(); // To get the note's attachment owner name
            echo $attchmentIns->getCreatedTime(); // To get attachment created time
            echo $attchmentIns->getModifiedTime(); // To get attachment modified time
        }
    }
}
$obj =new Record();
$obj->getAttachments();
 
Upload an Attachment
          
          
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Record{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
    public function uploadAttachment()
    {
        $record = ZCRMRestClient::getInstance()->getRecordInstance("{module_api_name}", "{record_id}"); // To get record instance
        $responseIns = $record->uploadAttachment("/path/to/file"); // $filePath - absolute path of the attachment to be uploaded.
        echo "HTTP Status Code:" . $responseIns->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:" . $responseIns->getDetails()['id'];
    }
    
}
$obj =new Record();
$obj->uploadAttachment();
 
Download an Attachment
          
          
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Record{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
    public function downloadAttachment()
    {
        $record = ZCRMRestClient::getInstance()->getRecordInstance("{module_api_name}", "{record_id}"); // To get record instance
        $fileResponseIns = $record->downloadAttachment("{attachment_id}");
        
        $filePath = "file/path";
        $fp = fopen($filePath.$fileResponseIns->getFileName(), "w"); // $filePath - absolute path where downloaded file has to be stored.
        echo "HTTP Status Code:" . $fileResponseIns->getHttpStatusCode();
        echo "File Name:" . $fileResponseIns->getFileName();
        $stream = $fileResponseIns->getFileContent();
        var_dump($stream);
        fputs($fp, $stream);
        fclose($fp);
    }
    
}
$obj =new Record();
$obj->downloadAttachment();
 
Delete an Attachment
          
          
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Record{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
    public function deleteAttachment()
    {
        $record = ZCRMRestClient::getInstance()->getRecordInstance("{module_api_name}", "{record_id}"); // To get record instance
        $fileResponseIns = $record->deleteAttachment("{attachment_id}");
        echo "HTTP Status Code:" . $fileResponseIns->getHttpStatusCode(); // To get http response code
        echo "Status:" . $fileResponseIns->getStatus(); // To get response status
        echo "Message:" . $fileResponseIns->getMessage(); // To get response message
        echo "Code:" . $fileResponseIns->getCode(); // To get status code
        echo "Details:" . $fileResponseIns->getDetails()['id'];
    }
    
}
$obj =new Record();
$obj->deleteAttachment();
 
Images in a Record
Upload a Photo
          
          
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Record{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
    public function uploadPhoto()
    {
        $record = ZCRMRestClient::getInstance()->getRecordInstance("{module_api_name}", "{record_id}"); // To get record instance
        $responseIns = $record->uploadPhoto("path/to/photo"); // $photoPath - absolute path of the photo to be uploaded.
        echo "HTTP Status Code:" . $responseIns->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:" . $responseIns->getDetails()['id'];
    }
    
}
$obj =new Record();
$obj->uploadPhoto();
 
Download a Photo
          
          
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Record{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
    public function downloadPhoto()
    {
        $record = ZCRMRestClient::getInstance()->getRecordInstance("{module_api_name}", "{record_id}"); // To get record instance
        $fileResponseIns = $record->downloadPhoto(); // to download the photo
        echo "HTTP Status Code:" . $fileResponseIns->getHttpStatusCode();
        echo "File Name:" . $fileResponseIns->getFileName();
        $filePath = "/Users/pravesh-pt2533/Desktop/";
        $fp = fopen($filePath.$fileResponseIns->getFileName(), "w"); // $filePath - absolute path where the downloaded photo is stored.
        $stream = $fileResponseIns->getFileContent();
        fputs($fp, $stream);
        fclose($fp);
    }
    
}
$obj =new Record();
$obj->downloadPhoto();
 
Delete a Photo
          
          
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Record{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
    public function deletePhoto()
    {
        $record = ZCRMRestClient::getInstance()->getRecordInstance("{module_api_name}", "{record_id}"); // To get record instance
        $responseIns = $record->deletePhoto(); // $photoPath - absolute path of the photo to be uploaded.
        echo "HTTP Status Code:" . $responseIns->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:" . $responseIns->getDetails()['id'];
    }
    
}
$obj =new Record();
$obj->deletePhoto();
 
Interlinking Records
Add Relation between Records
          
          
<?php
use zcrmsdk\crm\crud\ZCRMJunctionRecord;
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Record{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
    public function addRelation()
    {
        $record = ZCRMRestClient::getInstance()->getRecordInstance("{module_api_name}", "{record_id}"); // To get record instance
        $junctionrecord = ZCRMJunctionRecord::getInstance("{module_api_name}", "{record_id}"); // to get the junction record instance
        $responseIns = $record->addRelation($junctionrecord); // to add a relation between the record and the junction record
        echo "HTTP Status Code:" . $responseIns->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:" . $responseIns->getDetails()['id'];
    }
}
$obj =new Record();
$obj->addRelation();
 
Remove Relation between Records
          
          
<?php
use zcrmsdk\crm\crud\ZCRMJunctionRecord;
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Record{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
    public function removeRelation()
    {
        $record = ZCRMRestClient::getInstance()->getRecordInstance("{module_api_name}", "{record_id}"); // To get record instance
        $junctionrecord = ZCRMJunctionRecord::getInstance("{module_api_name}", "{record_id}"); // to get the junction record instance
        $responseIns = $record->removeRelation($junctionrecord); // to add a relation between the record and the junction record
        echo "HTTP Status Code:" . $responseIns->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:" . $responseIns->getDetails()['id'];
    }
}
$obj =new Record();
$obj->removeRelation();
 
Tags of a Record
Add Tags to Records
          
          
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Record{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
    public function addTags()
    {
        $record = ZCRMRestClient::getInstance()->getRecordInstance("{module_api_name}", "{record_id}"); // To get record instance
        $tagNames = array(
            "test1",
            "test2"
        ); // to create array of tag names
        $responseIns = $record->addTags($tagNames); // to add tags
        echo "HTTP Status Code:" . $responseIns->getHttpStatusCode(); // To get http response code
        echo "Status:" . $responseIns->getStatus(); // To get response status
        echo "Message:" . $responseIns->getMessage(); // To get response message
        echo "Code:" . $responseIns->getCode(); // To get status code
        echo "Details:" . json_encode($responseIns->getDetails());
    }
}
$obj =new Record();
$obj->addTags();
 
Remove Tags from Records
          
          
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Record{
    public function __construct()
    {
        $configuration =array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
        ZCRMRestClient::initialize($configuration);
    }
    public function removeTags()
    {
        $record = ZCRMRestClient::getInstance()->getRecordInstance("{module_api_name}", "{record_id}"); // To get record instance
        $tagNames = array(
            "test1",
            "test2"
        ); // to create array of tag names
        $responseIns = $record->removeTags($tagNames); // to remove tags
        echo "HTTP Status Code:" . $responseIns->getHttpStatusCode(); // To get http response code
        echo "Status:" . $responseIns->getStatus(); // To get response status
        echo "Message:" . $responseIns->getMessage(); // To get response message
        echo "Code:" . $responseIns->getCode(); // To get status code
        echo "Details:" . json_encode($responseIns->getDetails());
    }
}
$obj =new Record();
$obj->removeTags();