Android SDK Samples - Notes Operations
//$record object is of ZCRMRecord
//call getNotes() using $record object
$record.getNotes(object : DataCallback<BulkAPIResponse,List<ZCRMNote>>{
override fun completed(response: BulkAPIResponse, notes: List<ZCRMNote>) {
println(" ${response.responseJSON}")
}
override fun failed(exception: ZCRMException) {
println("Throws Exception : $exception")
}
})
//$record object is of ZCRMRecord
//call getNotes() using $record object by passing page and perPage as parameters
//page - page number of the notes
//perPage - no of notes to be given for a single page.
$record.getNotes(3,15,object:DataCallback<BulkAPIResponse,List<ZCRMNote>>
{
override fun completed(response: BulkAPIResponse, zcrmentity: List<ZCRMNote>) {
println("${response.responseJSON}")
}
override fun failed(exception: ZCRMException) {
println("Throws Exception : $exception")
}
})
//$record object is of ZCRMRecord
//call getNotes() using $record object by passing sortByField and sortOrder as parameters
//sortByField - field by which the notes get sorted
//sortOrder - sort order (asc, desc)
$record.getNotes("name", CommonUtil.SortOrder.ASC, object:DataCallback<BulkAPIResponse,List<ZCRMNote>>
{
override fun completed(response: BulkAPIResponse, zcrmentity: List<ZCRMNote>) {
println("${response.responseJSON}")
}
override fun failed(exception: ZCRMException) {
println("Throws Exception : $exception")
}
})
ZCRMSDKUtil.getModuleDelegate("Contacts").getRecordDelegate(371xxx006)//"371xxx006" is the ID of the record.
.getNote(371xxx003, object : DataCallback<APIResponse,ZCRMNote>//"371xxx003" is the ID of the note.
{
override fun completed(response: APIResponse, note: ZCRMNote) {
println("${response.responseJSON}")
}
override fun failed(exception: ZCRMException) {
println("Throws Exception : $exception")
}
})
ZCRMSDKUtil.getModuleDelegate("Contacts").getRecordDelegate(371xxx006) //"371xxx006" is the ID of the record.
.deleteNote(371xxx003, object : ResponseCallback<APIResponse>{
//"371xxx003" is the ID of the note
override fun completed(response: APIResponse) {
println(": ${response.responseJSON}")
}
override fun failed(exception: ZCRMException) {
println("Throws Exception : $exception")
}
})
//$record object is of ZCRMRecord
//To define a new note, call newNote() using $record object by passing the content and title as parameters.
//content - Content of the note.
//title - Title of the note.
val noteData = $record.newNote("This Deal is ready for final talk","Deal Update")
//To add the note, call addNote() using $record object by passing noteData as a parameter to it
//noteData - ZCRMNote to be added
$record.addNote(noteData, object : DataCallback<APIResponse,ZCRMNote>{
override fun completed(response: APIResponse, note: ZCRMNote) {
println("${response.responseJSON}")
}
override fun failed(exception: ZCRMException) {
println(" Throws Exception : $exception")
}
})