Skip to content
This repository has been archived by the owner on Oct 21, 2022. It is now read-only.

Commit

Permalink
update createTEI docs to include enrollment in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
taylordowns2000 committed Apr 8, 2019
1 parent e8a1bf6 commit 8677560
Showing 1 changed file with 23 additions and 16 deletions.
39 changes: 23 additions & 16 deletions README.md
Expand Up @@ -38,23 +38,30 @@ fetchAnalytics({

## Tracked Entity API

#### Create a new tracked entity instance from a CommCare form submission.
#### Create a new tracked entity instance and enroll them from a CommCare form submission.
```js
createTEI(
fields(
field("trackedEntity", "nEenWmSyUEp"),
field("orgUnit", "DiszpKrYNg8"),
field("attributes", function(state) {
return [{
"attribute": "w75KJ2mc4zz",
"value": dataValue("form.first_name")(state)
}, {
"attribute": "zDhUuAYrxNC",
"value": dataValue("form.last_name")(state)
}]
})
)
)
createTEI({
"trackedEntityType": "nEenWmSyUEp",
"orgUnit": "g8upMTyEZGZ",
"attributes": [
{
"attribute": "w75KJ2mc4zz",
"value": dataValue("form.first_name")(state)
},
{
"attribute": "zDhUuAYrxNC",
"value": dataValue("form.last_name")(state)
}
],
"enrollments": [
{
"orgUnit": "g8upMTyEZGZ",
"program": "IpHINAT79UW",
"enrollmentDate": "2019-04-08",
"incidentDate": "2019-04-08"
}
]
});
```

## Events API
Expand Down

0 comments on commit 8677560

Please sign in to comment.