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();