You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
rescocrm edited this page Aug 2, 2024
·
10 revisions
[v8.0] Gets the media tab document in form of base64 string.
Arguments
Argument
Type
Description
viewName
String
The name of the media tab.
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.
// WARNING: async/await pattern requires ECMAScript 6 and it's not supported on Internet Explorer.// It's supported by all modern browsers including mobile version of Chrome and Safari (requires Android 5+ and iOS 10+).MobileCRM.UI.EntityForm.requestObject(function(entityForm){return__awaiter(this,void0,void0,function*(){// get media tab by its namevarmedia=entityForm.getMediaTab("DocumentAction");varbase64String=yieldmedia.getData();MobileCRM.bridge.alert("base64String from media tab:\n"+base64String);varimg=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;});});