Android SDK Samples - Subforms Operations
Update Subform's Data
//$record is the object of ZCRMRecord
$record.setFieldValue(s)
//define the subforms with their data
val subformList1 = arrayListOf<ZCRMSubformRecord>()
val subformList2 = arrayListOf<ZCRMSubformRecord>()
//call newSubFormRecord() by passing the subformName as a parameter
//subformName - Name of the sub form to be created.
val subform1 = ZCRMSDKUtil.getModuleDelegate("Contacts").newSubFormRecord("Languages")
subform1.setFieldValue("Proficiency", "Native")
subform1.setFieldValue("Languages_Known", "French")
subformList1.add(subform1)
val subform2 = ZCRMSDKUtil.getModuleDelegate("Contacts").newSubFormRecord("Availability")
subform2.setFieldValue("Location", "Zylker Inc")
subform2.setFieldValue("Availability", "Weekdays")
subformList2.add(subform2)
//call addSubforms() using $record object by passing the name of the subform and the subform lists as parameters
$record.addSubforms("Languages",subformList1)
$record.addSubforms("Availability", subformList2)
//call update() using $record object
$record.update(object : DataCallback<APIResponse, ZCRMRecord>
{
override fun completed(response: APIResponse, zcrmRecord: ZCRMRecord)
{
println("${response.responseJSON}")
}
override fun failed(exception: ZCRMException)
{
println("Throws Exception: $exception")
}
})
Insert Subform's Data