file.writeText() not creating file

Solved
CS
Codipack Saas
maatwerkbedrijfbwb

Hi

I've had this script that I run to let the user assign a name to the device. This worked on an older version of Mobicontrol but on the latest version I'm getting an error where the script fails to write to a file.

#!/usr/bin/env js

var file = new mobicontrol.io.File('/sdcard/SOTI/attr_devicename.ini');
mobicontrol.message.createTextPromptDialog('Device name?')
.withQuestionIcon()
.withCallback(onConfirm).show();

function onConfirm(result) {
if (result.inputText != null) {
mobicontrol.log.info(result.inputText + ' is the name of the device');
file.writeText('[DeviceInfo]' + '\n' + 'DeviceName = ' + result.inputText);
mobicontrol.agent.checkIn();
}
}
 
Error Message
3 years ago
Android Scripting
ANSWERS