Run your entire business on Zoho with our unified cloud software, designed to help you break down silos between departments and increase organizational efficiency.
require 'ZOHOCRMSDK2_0'
class Layout
def self.get_layouts(module_api_name)
# """
# This method is used to get metadata about all the layouts of a module and print the response.
# :param module_api_name: The API Name of the module to get layouts.
# """
# """
# example
# module_api_name = "Leads";
# """
# Get instance of LayoutsOperations Class that takes module_api_name as parameter
lo = ZOHOCRMSDK::Layouts::LayoutsOperations.new(module_api_name)
# Call get_layouts method
response = lo.get_layouts
unless response.nil?
# Get the status code from response
status_code = response.status_code
print "\n Status Code :" + status_code.to_s
if [204, 304].include? status_code
print(status_code == 204 ? 'No Content' : 'Not Modified')
return
end
# Check if expected instance is received.
if response.is_expected
# Get object from response
response_handler = response.data_object
# Check if expected ResponseWrapper instance is received.
if response_handler.is_a? ZOHOCRMSDK::Layouts::ResponseWrapper
# Get the list of obtained Layout instances
layouts = response_handler.layouts
layouts.each do |layout|
# Get the CreatedTime of each Layout
unless layout.created_time.nil?
print "\nLayout CreatedTime: "
print layout.created_time
end
# Check if ConvertMapping is not None
# Get the ConvertMapping map
layout.convert_mapping&.each do |k, v|
print "\n"
print k
print v
print "\n"
end
# Get the ModifiedTime of each Layout
print "\nLayout ModifiedTime: "
print layout.modified_time
# Get the Visibility of each Layout
print "\nLayout Visible: "
print layout.visible
# Get the createdFor User instance of each Layout
created_for = layout.created_for
unless created_for.nil?
# Get the Name of the created_for User
print "\n Layout CreatedFor User-Name:"
print created_for.name.to_s
# Get the ID of the created_for User
print "\n Layout CreatedFor User-ID:"
print created_for.id.to_s
# Get the Email of the created_for User
end
# Get the Name of each Layout
print "\nLayout Name: "
print layout.name
# Get the modifiedBy User instance of each Layout
modified_by = layout.modified_by
# Check if modifiedBy is not None
unless modified_by.nil?
# Get the Name of the modified_by User
print "\n Layout ModifiedBy User-Name:"
print modified_by.name
# Get the ID of the modified_by User
print "\n Layout ModifiedBy User-ID:"
print modified_by.id.to_s
end
# Check if profiles is not null
profiles = layout.profiles
# Check if profiles is not null
# Get the Default of each Profile
# Get the Name of each Profile
# Get the ID of each Profile
profiles&.each do |profile|
# Get the Default of each Profile
print "\n Layout Profile Default:"
print profile.default
# Get the Name of each Profile
print "\n Layout Profile Name: "
print profile.name
# Get the ID of each Profile
print "\n Layout Profile ID: "
print profile.id.to_s
print "\n"
end
# Get the Layout ID of each Layout
print "\nLayout ID: "
print layout.id.to_s
# Get the Layout Status of each Layout
print "\nLayout status: "
print layout.status
# Get the modifiedBy User instance of each Layout
created_by = layout.created_by
# Check if created_by is not None
unless created_by.nil?
# Get the Name of the created_by User
print "\n Layout Created User-Name:"
print created_by.name
# Get the ID of the created_by User
print "\n Layout Created User-ID:"
print created_by.id
end
# Get the sections of each Layout
sections = layout.sections
# Get the DisplayLabel of each Section
# Get the SequenceNumber of each Section
# Get the Issubformsection of each Section
# Get the TabTraversal of each Section
# Get the APIName of each Section
# Get the ColumnCount of each Section
# Get the Name of each Section
# Get the GeneratedType of each Section
# Get the fields of each Section
# Check if fields is not None
# Get the properties instance of each Section
# Check if properties is not null
# Get the ReorderRows of Properties
# Get the tooltip instance of the Properties
# Check if tooltip is not None
# Get the Name of the ToolTip
# Get the Value of the ToolTip
# Get the MaximumRows of each Properties
sections&.each do |section|
# Get the DisplayLabel of each Section
print "\n Layout Section DisplayLabel:"
print section.display_label
# Get the SequenceNumber of each Section
print "\n Layout Section Sequence Number:"
print section.sequence_number
# Get the Issubformsection of each Section
print "\n Layout Section Issubformsection:"
print section.issubformsection
# Get the TabTraversal of each Section
print "\n Layout Section TabTraversal:"
print section.tab_traversal
# Get the APIName of each Section
print "\n Layout Section APIName:"
print section.api_name
# Get the ColumnCount of each Section
print "\n Layout Section ColumnCount:"
print section.column_count
# Get the Name of each Section
print "\n Layout Section Name:"
print section.name
# Get the GeneratedType of each Section
print "\n Layout Section GeneratedType:"
print section.generated_type
# Get the fields of each Section
fields = section.fields
# Check if fields is not None
fields&.each do |field|
print_field(field)
end
# Get the properties instance of each Section
properties = section.properties
# Check if properties is not null
unless properties.nil?
# Get the ReorderRows of Properties
print "\n Layout Section Properties ReorderRows: "
print properties.reorder_rows
# Get the tooltip instance of the Properties
tooltip = properties.tooltip
# Check if tooltip is not None
unless tooltip.nil?
# Get the Name of the ToolTip
print "\n Layout Section Properties ToolTip Name: "
print tooltip.name
# Get the Value of the ToolTip
print "\n Layout Section Properties ToolTip Value: "
print tooltip.value
end
# Get the MaximumRows of each Properties
print "\nLayout Section Properties MaximumRows: "
print properties.maximum_rows
end
end
print "\nLayout Id: "
print layout.id.to_s
end
# Check if the request returned an exception
elsif response_handler.is_a? ZOHOCRMSDK::Layouts::APIException
exception = response_handler
# Get the Code
print 'code:'
print exception.code.value
# Get the Status
print "\n status:"
print exception.status.value
# Get the Message
print "\n message:"
print exception.message.value
# Get the details map
exception.details.each do |k, v|
print "\n"
print k
print v
print "\n"
end
print "\n"
end
elsif status_code != 204
response_object = response.data_object
response_object.instance_variables.each do |field|
print field
print "\n"
print response_object.instance_variable_get(field)
end
end
end
end
end
Get a Layout
require 'ZOHOCRMSDK2_0'
class Layout
def self.get_layout(module_api_name, layout_id)
# """
# This method is used to get metadata about a single layout of a module with layoutID and print the response.
# :param module_api_name: The API Name of the layout's module
# :param layout_id: The ID of the layout to be obtained
# """
# """
# example
# module_api_name = "Leads"
# layout_id = "34770610091055"
# """
# Get instance of LayoutsOperations Class that takes module_api_name as parameter
lo = ZOHOCRMSDK::Layouts::LayoutsOperations.new(module_api_name)
# Call get_layout method that takes layout_id as parameter
response = lo.get_layout(layout_id)
unless response.nil?
# Get the status code from response
status_code = response.status_code
print "\n Status Code :" + status_code.to_s
if [204, 304].include? status_code
print(status_code == 204 ? 'No Content' : 'Not Modified')
return
end
# Check if expected instance is received.
if response.is_expected
# Get object from response
response_handler = response.data_object
# Check if expected ResponseWrapper instance is received.
if response_handler.is_a? ZOHOCRMSDK::Layouts::ResponseWrapper
# Get the list of obtained Layout instances
layouts = response_handler.layouts
layouts.each do |layout|
# Get the CreatedTime of each Layout
unless layout.created_time.nil?
print "\nLayout CreatedTime: "
print layout.created_time
end
# Check if ConvertMapping is not None
# Get the ConvertMapping map
layout.convert_mapping&.each do |k, v|
print "\n"
print k
print v
print "\n"
end
# Get the ModifiedTime of each Layout
print "\nLayout ModifiedTime: "
print layout.modified_time
# Get the Visibility of each Layout
print "\nLayout Visible: "
print layout.visible
# Get the createdFor User instance of each Layout
created_for = layout.created_for
unless created_for.nil?
# Get the Name of the created_for User
print "\n Layout CreatedFor User-Name:"
print created_for.name.to_s
# Get the ID of the created_for User
print "\n Layout CreatedFor User-ID:"
print created_for.id.to_s
# Get the Email of the created_for User
end
# Get the Name of each Layout
print "\nLayout Name: "
print layout.name
# Get the modifiedBy User instance of each Layout
modified_by = layout.modified_by
# Check if modifiedBy is not None
unless modified_by.nil?
# Get the Name of the modified_by User
print "\n Layout ModifiedBy User-Name:"
print modified_by.name
# Get the ID of the modified_by User
print "\n Layout ModifiedBy User-ID:"
print modified_by.id.to_s
end
# Check if profiles is not null
profiles = layout.profiles
# Check if profiles is not null
# Get the Default of each Profile
# Get the Name of each Profile
# Get the ID of each Profile
profiles&.each do |profile|
# Get the Default of each Profile
print "\n Layout Profile Default:"
print profile.default
# Get the Name of each Profile
print "\n Layout Profile Name: "
print profile.name
# Get the ID of each Profile
print "\n Layout Profile ID: "
print profile.id.to_s
print "\n"
end
# Get the Layout ID of each Layout
print "\nLayout ID: "
print layout.id.to_s
# Get the Layout Status of each Layout
print "\nLayout status: "
print layout.status
# Get the modifiedBy User instance of each Layout
created_by = layout.created_by
# Check if created_by is not None
unless created_by.nil?
# Get the Name of the created_by User
print "\n Layout Created User-Name:"
print created_by.name
# Get the ID of the created_by User
print "\n Layout Created User-ID:"
print created_by.id
end
# Get the sections of each Layout
sections = layout.sections
# Get the DisplayLabel of each Section
# Get the SequenceNumber of each Section
# Get the Issubformsection of each Section
# Get the TabTraversal of each Section
# Get the APIName of each Section
# Get the ColumnCount of each Section
# Get the Name of each Section
# Get the GeneratedType of each Section
# Get the fields of each Section
# Check if fields is not None
# Get the properties instance of each Section
# Check if properties is not null
# Get the ReorderRows of Properties
# Get the tooltip instance of the Properties
# Check if tooltip is not None
# Get the Name of the ToolTip
# Get the Value of the ToolTip
# Get the MaximumRows of each Properties
sections&.each do |section|
# Get the DisplayLabel of each Section
print "\n Layout Section DisplayLabel:"
print section.display_label
# Get the SequenceNumber of each Section
print "\n Layout Section Sequence Number:"
print section.sequence_number
# Get the Issubformsection of each Section
print "\n Layout Section Issubformsection:"
print section.issubformsection
# Get the TabTraversal of each Section
print "\n Layout Section TabTraversal:"
print section.tab_traversal
# Get the APIName of each Section
print "\n Layout Section APIName:"
print section.api_name
# Get the ColumnCount of each Section
print "\n Layout Section ColumnCount:"
print section.column_count
# Get the Name of each Section
print "\n Layout Section Name:"
print section.name
# Get the GeneratedType of each Section
print "\n Layout Section GeneratedType:"
print section.generated_type
# Get the fields of each Section
fields = section.fields
# Check if fields is not None
fields&.each do |field|
print_field(field)
end
# Get the properties instance of each Section
properties = section.properties
# Check if properties is not null
unless properties.nil?
# Get the ReorderRows of Properties
print "\n Layout Section Properties ReorderRows: "
print properties.reorder_rows
# Get the tooltip instance of the Properties
tooltip = properties.tooltip
# Check if tooltip is not None
unless tooltip.nil?
# Get the Name of the ToolTip
print "\n Layout Section Properties ToolTip Name: "
print tooltip.name
# Get the Value of the ToolTip
print "\n Layout Section Properties ToolTip Value: "
print tooltip.value
end
# Get the MaximumRows of each Properties
print "\nLayout Section Properties MaximumRows: "
print properties.maximum_rows
end
end
print "\nLayout Id: "
print layout.id.to_s
end
# Check if the request returned an exception
elsif response_handler.is_a? ZOHOCRMSDK::Layouts::APIException
exception = response_handler
# Get the Code
print 'code:'
print exception.code.value
# Get the Status
print "\n status:"
print exception.status.value
# Get the Message
print "\n message:"
print exception.message.value
# Get the details map
exception.details.each do |k, v|
print "\n"
print k
print v
print "\n"
end
print "\n"
end
elsif status_code != 204
response_object = response.data_object
response_object.instance_variables.each do |field|
print field
print "\n"
print response_object.instance_variable_get(field)
end
end
end
end
end