-
Notifications
You must be signed in to change notification settings - Fork 26
MobileCRM.UI.MediaTab.getData
rescocrm edited this page Aug 2, 2024
·
10 revisions
[v8.0] Gets the media tab document in form of base64 string.
Argument | Type | Description |
---|---|---|
viewName | String | The name of the media tab. |
callback | function(String) | The callback function that is called asynchronously with the base64-encoded document data. |
errorCallback | function(errorMsg) | The errorCallback which is called in case of error. |
scope | Object | The scope for callbacks. |
This example demonstrates how to retrieve data from existing media tab (in our case with name "DocumentAction"). In case of image data, resulting base64 can be set as source of the <img> element.
MobileCRM.UI.EntityForm.requestObject(function (entityForm) {
// get media tab by its name
var media = entityForm.getMediaTab("DocumentAction");
media.getData(function (base64String) {
MobileCRM.bridge.alert("base64String from media tab:\n" + base64String);
var img = document.getElementById("imgTarget");
if (img)
// Construct data URL from base64 data and set it as a source to <img> element.
img.src = "data:;base64," + base64String;
}, MobileCRM.bridge.alert);
}, MobileCRM.bridge.alert, null);