I have below code and dont ask why in batch the Bindata.loadfile has a file not found error
Yes i did full compile full CILL restart aos service.
code is running client site without any issues (AX 2012R3 latest binaries)
private container saveToLog(str _jsonstring)
{
TextIo textIo;
BinData binData = new BinData();
FileIOPermission permission;
str tmpFile;
if(isRunningOnServer())
{
info('server');
tmpFile = WinAPIServer::getTempPath()+guid2str(newGuid())+ '.json';
}
else
{
info('client');
tmpFile = WinAPI::getTempPath()+guid2str(newGuid())+ '.json';
}
permission = new FileIOPermission(tmpFile, 'RW');
permission.assert();
textIo = new TextIo(tmpFile,"W");
textIo.write(_jsonstring);
textIo = null;
if(isRunningOnServer())
{
if(WinAPIServer::fileExists(tmpFile))
{
info('found');
}
else
{
info('not found');
}
}
else
{
if(WinAPI::fileExists(tmpFile))
{
info('found');
}
else
{
info('not found');
}
}
if( binData.loadFile(tmpFile))//FILE not found error in batch
{
return binData.getData();
}
if(isRunningOnServer())
{
WinAPIServer::deleteFile(tmpFile);
}
else
{
WinAPI::deleteFile(tmpFile);
}
return conNull();
}