Appearance
Editing Documents
Create a new document
javascript
const d = await Aeppic.new('document-form', 'parent-document')
d.data.name = 'New document'
Aeppic.save(d)
Edit an existing document
javascript
const d = await Aeppic.edit('document id')
Insert or update a document
Sometimes it is helpful to create a document exactly once and just update it with the latest available data. Create it when needed or update it should it already have existed.
In cases like this the document needs a predictable identifier. It is best to derive it from the documents parent id with a well-known string. The function Aeppic.Functions.deriveChildId
generates that by concatenating the arguments in a standardized fashion for that purpose.
javascript
const d = await Aeppic.new('document-form', 'parent-document', {
id: Aeppic.Functions.deriveChildId('parent-document', 'my-service', 'abc')
insertOrUpdate: true
})
d.data.name = 'My Name'
Aeppic.save(d)