← Back to team overview

dhis2-devs team mailing list archive

Saving an enrollment

 

Hi,

I am using the Master branch sdk for developing Emmunify Android app. I
am trying to save an enrollment but it gives me an error when I try to
save it. Following is the code:

            Enrollment enrollment = new Enrollment();
            enrollment.setProgram("Child Registration");
            enrollment.setOrgUnit("Vaccine Organization");
            enrollment.setDateOfEnrollment(new DateTime());
            enrollment.setDateOfIncident(new DateTime());

            TrackedEntityAttributeValue firstName = new
TrackedEntityAttributeValue();
            firstName.setTrackedEntityAttributeUId("s2rNdsWsnQc");
            firstName.setValue("Maitri";

            TrackedEntityAttributeValue lastName = new
TrackedEntityAttributeValue();
            lastName.setTrackedEntityAttributeUId("tnxpai82lGX");
            lastName.setValue("Patel");

            List<TrackedEntityAttributeValue> values = new
ArrayList<>();
            values.add(firstName);
            values.add(lastName);

            enrollment.setTrackedEntityAttributeValues(values);

Now when I try to save it I get the following error

           Unsupported type: class
org.hisp.dhis.client.sdk.models.enrollment.Enrollment

Are enrollments are supposed to be save in some other manner?

Follow ups