Android SDK Samples - Share Operations
//$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")
}
})
//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")
}
})
//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")
}
})
//$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")
}
})