Class Hierarchy - C# SDK

Class Hierarchy - C# SDK

All Zoho CRM entities are modelled as modules having classes, methods and instance variables applicable to that particular entity. ZCRMRestClient is the base class of the C# SDK. ZCRMRestClient has methods to get instances of various other Zoho CRM entities. It is in RestClient module.
  • ZCRMRestClient is the base class of the SDK.
  • This class has, methods to get instances of various other Zoho CRM entities.
  • The class relations and hierarchy of the SDK follows the entity hierarchy inside Zoho CRM.
  • Each class entity has functions to fetch its own properties and to fetch data of its immediate child entities through an API call.For example: a Zoho CRM module (ZCRMModule) object will have member functions to get a module’s properties like display name, module Id, etc, and will also have functions to fetch all its child objects (like ZCRMLayout).
The class relations and hierarchy of the SDK follows the entity hierarchy inside Zoho CRM. The class hierarchy of various Zoho CRM entities are given below:



As appearing in the hierarchy, every entity class will have instance variables to fetch its own properties and to fetch data of its immediate child entities through an API call.

Instance Objects

It is not always effective to follow the complete class hierarchy from the top to fetch the data of an entity at some lower level, since this would involve API calls at each level. In order to handle this, every entity class will have a GetInstance() method to get its own dummy object and instance variables to get dummy objects of its child entities.

Note

GetInstance() methods would not have any of its properties filled, since it would not fire an API call. This would just return a dummy object that shall be only used to access the non-static methods of the class.

Summing it up,
  • ZCRMRestClient.GetInstance().GetModule("Contacts") would return the actual Contacts module, that has all the properties of the Contacts module filled through an API call.
  • ZCRMRestClient.GetModuleInstance("Contacts") would return a dummy ZCRMModule object that would refer to the Contacts module, with no properties filled, since this doesn’t make an API call.
Hence, to get records from a module, you need not to start all the way from ZCRMRestClient. Instead, you could get a ZCRMModule instance with ZCRMModule.GetInstance(module_api_name) and then invoke its nonstatic GetRecords() method from the created instance. This would avoid the API call which would have been triggered to populate the ZCRMModule object.

Accessing record properties

Since record properties are dynamic across modules, we have only given the common fields like CreatedTime, CreatedBy, Owner etc, as ZCRMRecord’s default members. All other record properties are available as a map in ZCRMRecord object.

To access the individual field values of a record, use the getter and setter methods available. The keys of the record properties map are the API names of the module’s fields. API names of all fields of all modules are available under,

Setup → Marketplace → APIs → CRM API → API Names
  • To get a field value, use record.GetFieldValue(field_api_name);
  • To set a field value, use record.SetFieldValue(field_api_name, new_value);
While setting a field value, please make sure of that the set value is of the data type of the field to which you are going to set it.

    • Related Articles

    • Class Hierarchy - Java SDK

      All Zoho CRM entities are modelled as classes having members and methods applicable to that particular entity. ZCRMRestClient is the base class of the SDK. This class has, methods to get instances of various other Zoho CRM entities. The class ...
    • Class Hierarchy - PHP SDK

      All Zoho CRM entities are modelled as classes having members and methods applicable to that particular entity. ZCRMRestClient is the base class of the SDK. This class has, methods to get instances of various other Zoho CRM entities. The class ...
    • Class Hierarchy - Node JS SDK

      All Zoho CRM entities are modelled as modules having classes, methods and instance variables applicable to that particular entity. ZCRMRestClient is the base class of the Python SDK. ZCRMRestClient has methods to get instances of various other Zoho ...
    • Class Hierarchy - Python SDKs

      All Zoho CRM entities are modelled as modules having classes, methods and instance variables applicable to that particular entity. ZCRMRestClient is the base class of the Python SDK. ZCRMRestClient has methods to get instances of various other Zoho ...
    • C# SDK - An Overview

      C# SDK offers a way to create client C# applications that can be integrated with Zoho CRM. This SDK makes the access and use of necessary CRM APIs with ease. In other words, it serves as a wrapper for the REST APIs, making it easier to use the ...