Android SDK Samples - Metadata Operations

Get All Modules' Metadata
          
          
ZCRMSDKUtil.getModules(object: DataCallback<BulkAPIResponse,List<ZCRMModule>>
    {
        override fun completed(response: BulkAPIResponse, zcrmentity: List<ZCRMModule>)
        {
            println("${response.responseJSON}")
        }

        override fun failed(exception: ZCRMException)
        {
            println("Throws Exception: $exception")
        }

    })
 
Get a Module's Metadata
          
          
ZCRMSDKUtil.getModule("Contacts",object : DataCallback<APIResponse,ZCRMModule>{
    //Contacts is the moduleAPI name
                    override fun completed(response: APIResponse, module: ZCRMModule) {
                        println("${response.responseJSON}")
                    }
    
                    override fun failed(exception: ZCRMException) {
                        println("Throws Exception : $exception")
                    }
    
                })
 
Get All Fields' Metadata
          
          
//$module object is of ZCRMModule

//call getFields() using $module object

$module.getFields(object : DataCallback<BulkAPIResponse,List<ZCRMField>>
    {
        override fun completed(response: BulkAPIResponse, zcrmFields: List<ZCRMField>)
        {
            println("${response.responseJSON}")
        }

        override fun failed(exception: ZCRMException)
        {
            println("Throws Exception : $exception")
        }
    })
 
Get All Fields' Metadata from the Server
          
          
//$module object is of ZCRMModule

//call getFieldsFromServer() using $module object

$module.getFieldsFromServer(object : DataCallback<BulkAPIResponse,List<ZCRMField>>
    {
        override fun completed(response: BulkAPIResponse, fields: List<ZCRMField>)
        {
            println("${response.responseJSON}")
        }

        override fun failed(exception: ZCRMException)
        {
            println("Throws Exception : $exception")
        }
    })
 
Get a Field's Metadata by its ID
          
          
//$module object is of ZCRMModule

//call getField() using $module object by passing the fieldId as a parameter
//fieldId - Id of the field to be returned

$module.getField(365xxx398, object : DataCallback<APIResponse,ZCRMField>
    {
        override fun completed(response: APIResponse, field: ZCRMField) 
        {
            println("${response.responseJSON}")
        }

        override fun failed(exception: ZCRMException) 
        {
            println("Throws Exception : $exception")
        }
    })
 
Get a Field's Metadata by its ID from the Server
          
          
//$module object is of ZCRMModule

//call getFieldFromServer() using $module object by passing the fieldId as a parameter

//fieldId - Id of the field to be returned

$module.getFieldFromServer(3652xxx398, object : DataCallback<APIResponse,ZCRMField>
    {
        override fun completed(response: APIResponse, field: ZCRMField)
        {
            println("${response.responseJSON}")
        }

        override fun failed(exception: ZCRMException)
        {
            println("Throws Exception : $exception")
        }
    })
 
Get All Layouts' Metadata
          
          
//$module object is of ZCRMModule

//call getLayouts() using $module object

$module.getLayouts(object : DataCallback<BulkAPIResponse,List<ZCRMLayout>>
    {
        override fun completed(response: BulkAPIResponse, layouts: List<ZCRMLayout>) {
            println("${response.responseJSON}")
        }

        override fun failed(exception: ZCRMException) {
            println("get layouts failed : $exception")
        }
    })
 
Get All Layouts' Metadata from the Server
          
          
//$module object is of ZCRMModule

//call getLayoutsFromServer() using $module object

$module.getLayoutsFromServer(object: DataCallback<BulkAPIResponse,List<ZCRMLayout>>
    {
        override fun completed(response: BulkAPIResponse, zcrmLayouts: List<ZCRMLayout>)
        {
            println("${response.responseJSON}")
        }

        override fun failed(exception: ZCRMException)
        {
            println("Throws Exception : $exception")
        }
    })
 
Get a Layout's Metadata by its ID
          
          
//$module object is of ZCRMModule

//call getLayout() using $module object by passing the layoutId as a parameter

//layoutId - Id of the layout to be returned

$module.getLayout(410xxx1001, object : DataCallback<APIResponse, ZCRMLayout>
    {
        override fun completed(response: APIResponse, layout: ZCRMLayout)
        {
            println("${response.responseJSON}")
        }

        override fun failed(exception: ZCRMException)
        {
            println("Throws Exception: $exception")
        }
    })
 
Get a Layout's Metadata by its ID from the Server
          
          
//$module object is of ZCRMModule

//call getLayoutFromServer() using $module object by passing the layoutId as a parameter

//layoutId - Id of the layout to be returned

$module.getLayoutFromServer(410xxx1001, object : DataCallback<APIResponse, ZCRMLayout>
    {
        override fun completed(response: APIResponse, layout: ZCRMLayout)
        {
            println("${response.responseJSON}")
        }

        override fun failed(exception: ZCRMException)
        {
            println("Throws Exception: $exception")
        }
    })
 
Get All Related Lists' Metadata
          
          
//$module object is of ZCRMModule

//call getRelatedLists() using $module object 

$module.getRelatedLists(object : DataCallback<BulkAPIResponse,List<ZCRMModuleRelation>>
    {
        override fun completed(response: BulkAPIResponse, moduleRelations:List<ZCRMModuleRelation>)
        {
            println("${response.responseJSON}")
        }

        override fun failed(exception: ZCRMException)
        {
            println("Throws Exception : $exception")
        }
    })
 
Get All Related Lists' Metadata from the Server
          
          
//$module object is of ZCRMModule

//call getRelatedListsFromServer() using $module object 

$module.getRelatedListsFromServer(object : DataCallback<BulkAPIResponse,List<ZCRMModuleRelation>>
    {
        override fun completed(response: BulkAPIResponse, moduleRelations:List<ZCRMModuleRelation>)
        {
            println("${response.responseJSON}")
        }

        override fun failed(exception: ZCRMException)
        {
            println("Throws Exception : $exception")
        }
    })
 
Get a Related List's Metadata by its ID
          
          
//$module object is of ZCRMModule

//call getRelatedList() using $module object by passing the relatedlistId as a parameter

//relatedlistId - Id of the Related list to be returned

$module.getRelatedList(365xxx122, object : DataCallback<APIResponse,ZCRMModuleRelation>
    {
        override fun completed(response: APIResponse, moduleRelation: ZCRMModuleRelation)
        {
            println("${response.responseJSON}")
        }

        override fun failed(exception: ZCRMException)
        {
            println("Throws Exception : $exception")
        }
    })
 
Get a Related List's Metadata by its ID from the Server
          
          
//$module object is of ZCRMModule

//call getRelatedListFromServer() using $module object by passing the relatedlistId as a parameter

//relatedlistId - Id of the Related list to be returned

$module.getRelatedListFromServer(365xxx122, object : DataCallback<APIResponse,ZCRMModuleRelation>
    {
        override fun completed(response: APIResponse, moduleRelation: ZCRMModuleRelation)
        {
            println("${response.responseJSON}")
        }

        override fun failed(exception: ZCRMException)
        {
            println("Throws Exception : $exception")
        }
    })
 
Get All Custom Views' Metadata
          
          
//$module object is of ZCRMModule

//call getCustomViews() using $module object

$module.getCustomViews(object:DataCallback<BulkAPIResponse,List<ZCRMCustomView>>
    {
        override fun completed(response: BulkAPIResponse, customviews:List<ZCRMCustomView>)
        {
            println("${response.responseJSON}")
        }

        override fun failed(exception: ZCRMException)
        {
            println("Throws Exception: $exception")
        }

    })
 
Get All Custom Views' Metadata from the Server
          
          
//$module object is of ZCRMModule

//call getCustomViewsFromServer() using $module object

$module.getCustomViewsFromServer(object:DataCallback<BulkAPIResponse,List<ZCRMCustomView>>
    {
        override fun completed(response: BulkAPIResponse, customviews:List<ZCRMCustomView>)
        {
            println("${response.responseJSON}")
        }

        override fun failed(exception: ZCRMException)
        {
            println("Throws Exception: $exception")
        }
    })
 
Get a Custom View's Metadata by its ID
          
          
//$module object is of ZCRMModule

//call getCustomView() using $module object by passing the id as a parameter

//id - Id of the custom view to be returned

$module.getCustomView(37xxxx615, object : DataCallback<APIResponse,ZCRMCustomView>
    {
        override fun completed(response: APIResponse, customView: ZCRMCustomView)
        {
            println("${response.responseJSON}")
        }
        override fun failed(exception: ZCRMException)
        {
            println("Throws Exception : $exception")
        }

    })
 
Get a Custom View's Metadata by its ID from the Server
          
          
//$module object is of ZCRMModule

//call getCustomViewFromServer() using $module object by passing the id as a parameter

//id - Id of the custom view to be returned

$module.getCustomViewFromServer(371xxx615, object : DataCallback<APIResponse,ZCRMCustomView>
    {
        override fun completed(response: APIResponse, customView: ZCRMCustomView)
        {
            println("${response.responseJSON}")
        }
        override fun failed(exception: ZCRMException)
        {
            println("Throws Exception : $exception")
        }
    })