Android SDK Samples - Share Operations

Get Shared Record Details
          
          
//$record object is of ZCRMRecord

//call getSharedDetails() using $record object

$record.getSharedDetails(object : DataCallback<BulkAPIResponse,List<ZCRMRecord.SharedDetails>>
    {
       override fun completed(response: BulkAPIResponse,sharedDetails: List<ZCRMRecord.SharedDetails>)
       {
           println("${response.responseJSON}")
       }
    
       override fun failed(exception: ZCRMException)
       {
           println("Throws Exception : $exception")
       }
     })
 
Share Records
          
          
//To define the user and access permission, call SharedDetails() by passing the respective user, AccessPermission and shareRelatedRecords as parameters to it.

//user - ZCRMUserDelegate of the respective user with whom you want to share the record.

//AccessPermission - access permission you want to give the user for that record. (FULL_ACCESS, READ_ONLY, READ_WRITE)

//shareRelatedRecords - Represents if you want to share the related records also with the user.(true, false)

val sharedDetails = ZCRMRecord.SharedDetails($user, CommonUtil.AccessPermission.FULL_ACCESS, false)

//$record object is of ZCRMRecord

//call share() using $record object by passing the sharedDetails as a parameter to it.

$record.share(sharedDetails, object: ResponseCallback<APIResponse>
{
   override fun completed(response: APIResponse)
   {
      println("${response.responseJSON}")
   }

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

})
 
Update Share Permissions
          
          
//To define the user and access permission, call SharedDetails() by passing the respective user, AccessPermission and shareRelatedRecords as parameters to it.

//$user - ZCRMUserDelegate of the respective user with whom you want to share the record.

//AccessPermission - access permission you want to give the user for that record. (FULL_ACCESS, READ_ONLY, READ_WRITE)

//shareRelatedRecords - Represents if you want to share the related records also with the user.(true, false)

val sharedDetails = ZCRMRecord.SharedDetails($user, CommonUtil.AccessPermission.FULL_ACCESS, true)

//$record object is of ZCRMRecord

//call updateSharedDetails() using $record object by passing sharedDetails as a parameter to it.

$record.updateSharedDetails(sharedDetails, object: ResponseCallback<APIResponse>
{
    override fun completed(response: APIResponse)
   {
       println("${response.responseJSON}")
   }

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

})  
 
Revoke Shared Records
          
          
//$record object is of ZCRMRecord

//call unshare() using $record object

$record.unshare(object : ResponseCallback<APIResponse>
    {
        override fun completed(response: APIResponse)
        {
           println("${response.responseJSON}")
        }
    
        override fun failed(exception: ZCRMException)
        {
          println("Throws Exception : $exception")
        }
    
    })
 
Get Shareable Users
          
          
//$record object is of ZCRMRecord

//call getShareableUsers() using $record object

$record.getShareableUsers(object:DataCallback<BulkAPIResponse,List<ZCRMUserDelegate>>
    {
        override fun completed(response: BulkAPIResponse, zcrmentity: List<ZCRMUserDelegate>) {
            println("${response.responseJSON}")
        }
    
        override fun failed(exception: ZCRMException) {
            println("Throws Exception:$exception")
        }
    
    })