-
Notifications
You must be signed in to change notification settings - Fork 1
Annotation
Niels Steenbeek edited this page Mar 24, 2020
·
4 revisions
An annotation is a default Entity having specific logic to upsert an Annotation. No need to generate the entity and write parsing and upsert logic.
The Annotation.service.ts has two important methods to do the upsert:
- parseAnnotation(blob: Blob,...), which parses a blob to an AnnotationModel
- upserRecord(annotationModel: AnnotationModel), which inserts or updates the Annotation
- retrieveClone(id: string), which returns a clone of an existing one
import {Model} from '../WebApi/Model';
export interface AnnotationModel extends Model {
annotationid?: string;
documentbody?: string;
filename?: string;
mimetype?: string;
notetext?: string;
objectid?: {
id: string;
logicalName: string;
};
subject?: string;
versionnumber?: string;
}
const entity = formContext.data.entity,
annotation = await AnnotationService.parseAnnotation(blob, 'MyFilename.png',
entity.getId(), entity.getEntityName());
await AnnotationService.upsertRecord(annotation);