Visualizzazione post con etichetta DIXF. Mostra tutti i post
Visualizzazione post con etichetta DIXF. Mostra tutti i post

martedì 2 febbraio 2021

D365FFO: Export data entity by Code X++

A simple way to export a data entity, using the powerful data management framework.

You need a definition group, where the entity is mapped and all parameters are set, this script allow you to simple get an output file. You can set or not the pushing method, in my case i need an option to force full puch when a entity is mapped using incremental pushing.


DMFDefinitionGroupName definitionGroupName;
DMFEntityName entityName;
DMFSourceName sourceName;
DMFExecutionId executionid = "..."; //Your unique execution identifier
DMFDefinitionGroup definitionGroup = DMFDefinitionGroup::find(definitionGroupName, true);

DMFEntityExporter exporter = new DMFEntityExporter();
Description description = "..."

DMFDefinitionGroupEntity definitionGroupEntity = DMFDefinitionGroupEntity::find(
	definitionGroupName",
	entityName,
	true);
	
DMFDefinitionGroupExecution::serviceInsertOrDisplay(definitionGroup,
	executionid,
	definitionGroupEntity.Entity,
	definitionGroupEntity.SampleFilePath,
	definitionGroup.Description,
	'',
	'',
	'',
	NoYes::Yes,
	DMFFileType::File,
	1,
	'',
	false,
	curExt());

DMFDefinitionGroupExecution definitionGroupExecution = DMFDefinitionGroupExecution::find(
	definitionGroupName,
	entityName,
	executionid,
	true);

ttsBegin;
definitionGroupExecution.selectForUpdate(true);
definitionGroupExecution.ExecuteTargetStep = NoYes::Yes;
if (...) //Full push condition
{
	definitionGroupExecution.DefaultRefreshType = DMFRefreshType::FullPush;
}
definitionGroupExecution.Update();
ttsCommit;

DataImportFramework::MoveToStaging(executionid);

SharedServiceUnitFileID fileId = DMFPackageExporter::exportToFileV2(
	definitionGroupName,
	executionid,
	entityName,
	sourceName);

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");
}

venerdì 11 marzo 2016

DIXF: Field 'Entity' must be filled in on DIXF (AX2012)

On AX2012 CU9 or later, if found it on CU10 for example, if you got this error, you can RUN this scripts. Is an update script of CU9, the entity name is a new field inserted on this version.

ReleaseUpdateDB63_DMF releaseUpdateDB63_DMF = new ReleaseUpdateDB63_DMF();
releaseUpdateDB63_DMF.updateEntityType();


Or, more simple, you can delete all entities, when you reopen the entities form all entities will be created. I know, you don't belive me, but it works.

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...