Android SDK Samples - Notes Operations

Get All Notes
          
          
//$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")
    }
})
 
Get Notes with the "page" param
          
          
//$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")
       }
    
    })
 
Get Notes with the "sort" param
          
          
//$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")
   }

})
 
Get a Note
          
          
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")
                    }

                })
 
Delete a Note
          
          
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")
                    }

                })
 
Add a Note to a Record
          
          
//$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")
    }
})
 
Update a Note of a Record
          
          
//$note object is of ZCRMNote

//define the title and content of the note using $note object
$note.title = "Contact Verification Status"
$note.content = "This contact has been verified successfully. Recommended to proceed further."

//$record object is of ZCRMRecord

//call updateNote() using $record object by passing the respective ZCRMNote as a parameter to it.

//$note - ZCRMNote to be updated

$record.updateNote($note, object: DataCallback<APIResponse, ZCRMNote>{
    override fun completed(response: APIResponse, zcrmentity: ZCRMNote) {
       println("${response.responseJSON}")
   }

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

})