Hi everyone,
I'm encountering an issue where the `Xrm.Device.pickFile` method is not opening the file manager on mobile devices.
I’m trying to use `Xrm.Device.pickFile` to allow users to select a file from their mobile devices, but the file manager doesn’t open when the method is called, however it does work in the Browser.
code snippet
var main = {
// pickfile (client API reference)
callMethod: function (executionContext) {
// Reading attribute value from the form
var formContext = executionContext.getFormContext();
var dailyUpdateId = formContext.data.entity.getId().replace("{", "").replace("}", "");
var uploadFileAttr = formContext.getAttribute("stu_photouploadfield").getValue();
var dailyUpdateName = formContext.getAttribute("stu_name").getValue(); // Assuming this is the field for daily update name
// Validating form field conditions
if (uploadFileAttr) {
var pickFileOptions = {
accept: ["*/*"], // Allow any file type
allowMultipleFiles: true // Allow multiple file selection
};
// Invoking pickFile Client API
Xrm.Device.pickFile(pickFileOptions).then(
function (data) {
// Handle the selected files
},
function error(error) {
// handle errors
}
);
}
}
};