-
Notifications
You must be signed in to change notification settings - Fork 26
MobileCRM.DynamicEntity.saveDocumentBody
Maros Kolibas edited this page Nov 28, 2019
·
8 revisions
Argument | Type | Description |
---|---|---|
entityId | String | GUID of the existing entity or "null" for new one. |
entityName | String | The logical name of the entity; optional, default is "annotation". |
relationship | MobileCRM.Relationship | The relationship with parent object. |
filePath | String | Absolute or app data-relative path to the file holding the body. |
mimeType | String | MimeType of the content, optional. |
success | function(MobileCRM.Reference) | A callback function for successful asynchronous result. The result argument will carry the Reference to updated/created entity. |
failed | function(error) | A callback function for command failure. The error argument will carry the error message. |
scope | A scope for calling the callbacks; set "null" to call the callbacks in global scope. |
This example demonstrates how to save the document body (e.g. attached image) for newly created annotation (Note). Following function locally stores the attachment (defined by file path) for newly created note.
function saveAnnotation(filePath, accountReference) {
///<param name='filePath' type='String'>path to file for annotation attachment.</param>
///<param name='accountReference' type='MobileCRM.Reference'>Reference to account.</param>
var relationship = new MobileCRM.Relationship("objectid", accountReference);
MobileCRM.DynamicEntity.saveDocumentBody(null, null, relationship, filePath, null, function (annotation) {
///<param name='annotation' type='MobileCRM.Reference'>Reference to nelwy created annotation.</param>
MobileCRM.bridge.alert(annotation.entityName + " '" + annotation.primaryName + "' successfully saved.");
}, MobileCRM.bridge.alert, null);
}