mercoledì 27 gennaio 2021

D365FFO: Start a Virtual Machine (Cloud hosted) using Powershell

The simplest way to wake up and start a cloud hosted virtual machine from your commmand line.

The authentication method is prompted login, but you can autheticate using another method as mentioned here: https://docs.microsoft.com/en-us/powershell/module/azurerm.profile/connect-azurermaccount?view=azurermps-6.13.0

1. Run powersheel

2. Connect-AzureRmAccount

3. Start-AzureRmVM -ResourceGroupName "yourresourcegroupname" -Name "maschineName"

More info here: https://docs.microsoft.com/en-us/powershell/module/azurerm.compute/?view=azurermps-6.13.0#virtual-machines

venerdì 22 gennaio 2021

D365FFO: Export data entity by code X++

 This is the code for exporting data entity using X++

Note: Export is done using batch job, consider it in case of used that on a performance requirement implementation

try
{
EntityName entityName = DMFEntity::findFirstByTableId(tableNum(VendVendorV2Entity)).EntityName;

Query query = new Query(DMFUtil::getDefaultQueryForEntity(entityName));
QueryBuildDataSource qbds = query.dataSourceTable(tableNum(BankPositivePayExportEntity));
DMFEntityExporter exporter = new DMFEntityExporter();
fileId = exporter.exportToFile(entityName,
definitionGroupName,
'', //Optional: ExecutionID
"CSV", //Optional::SourceName
#FieldGroupName_AllFields, //Optional field selection
query.pack(), //Optional: Filtered Query
curExt() //Optional: DataAReaId
);

if (fileId != '')
{
str downloadUrl = DMFDataPopulation::getAzureBlobReadUrl(str2Guid(fileId));

Filename filename = strFmt('export.csv');
System.IO.Stream stream = File::UseFileFromURL(downloadUrl);
File::SendFileToUser(stream, filename);
}
else
{
throw error("DMF execution failed and details were written to the execution log");
}
}
catch
{
error("error occurred while exporting");
}

AX 2012: The request was aborted: Could not create SSL/TLS secure channel

The error you're encountering, "The request was aborted: Could not create SSL/TLS secure channel," can occur due to various re...