Getting container value data while import and export in d365:
I have 1 field in my table which is container data type. I need to import/export that field data through data entity.
Example:
Table :PrintMgmtSettings
Field : QueryPacked , EDT : PackedQueryRun (container data type)
Here in this field data will store in binary code , we need to retrieve that binary code while import and export.
Created:
data entity : FBHPrintMgmtSettingsEntity
Data source : PrintMgmtSettings
Added all fields from data source to entity
Staging table for data entity : FBHPrintMgmtSettingsStaging
Added one extra field :
Field : QueryPackedFileName
EDT: Filename
Added one method in staging table :
public static container getFieldsToBeConvertedToFile()
{
return [ ['QueryPacked', 'QueryPacked', 'QueryPackedFileName', true] ];
}
Here QueryPacked is our original table field and QueryPackedFileName added one extra field in staging table. It will store the container QueryPacked field data in one file for each record.
Now add one method in entity : postTargetProcess
this method will update the querypacked fild data from staging.
public static void postTargetProcess(DMFDefinitionGroupExecution _dmfDefinitionGroupExecution)
{
FBHPrintMgmtSettingsStaging staging;
PrintMgmtSettings printMgmtSettings;
printMgmtSettings.skipAosValidation(true);
printMgmtSettings.skipDataMethods(true);
while select QueryPacked,PrintJobSettings, ParentId,PrintSettingPriorityId, RecId from staging
where staging.DefinitionGroup == _dmfDefinitionGroupExecution.DefinitionGroup &&
staging.ExecutionId == _dmfDefinitionGroupExecution.ExecutionId
{
select firstonly forupdate QueryPacked, RecId from printMgmtSettings
where printMgmtSettings.ParentId == staging.ParentId
&& printMgmtSettings.PriorityId == staging.PrintSettingPriorityId;
if (printMgmtSettings)
{
printMgmtSettings.QueryPacked = staging.QueryPacked;
ttsbegin;
printMgmtSettings.doupdate();
ttscommit;
}
}
}
when you exporting entity and download the package you will have one extra file in that package folder with name : Resource
here in this Resource folder for each record we have one file with querypacked field data.
I have 1 field in my table which is container data type. I need to import/export that field data through data entity.
Example:
Table :PrintMgmtSettings
Field : QueryPacked , EDT : PackedQueryRun (container data type)
Here in this field data will store in binary code , we need to retrieve that binary code while import and export.
Created:
data entity : FBHPrintMgmtSettingsEntity
Data source : PrintMgmtSettings
Added all fields from data source to entity
Staging table for data entity : FBHPrintMgmtSettingsStaging
Added one extra field :
Field : QueryPackedFileName
EDT: Filename
Added one method in staging table :
public static container getFieldsToBeConvertedToFile()
{
return [ ['QueryPacked', 'QueryPacked', 'QueryPackedFileName', true] ];
}
Here QueryPacked is our original table field and QueryPackedFileName added one extra field in staging table. It will store the container QueryPacked field data in one file for each record.
Now add one method in entity : postTargetProcess
this method will update the querypacked fild data from staging.
public static void postTargetProcess(DMFDefinitionGroupExecution _dmfDefinitionGroupExecution)
{
FBHPrintMgmtSettingsStaging staging;
PrintMgmtSettings printMgmtSettings;
printMgmtSettings.skipAosValidation(true);
printMgmtSettings.skipDataMethods(true);
while select QueryPacked,PrintJobSettings, ParentId,PrintSettingPriorityId, RecId from staging
where staging.DefinitionGroup == _dmfDefinitionGroupExecution.DefinitionGroup &&
staging.ExecutionId == _dmfDefinitionGroupExecution.ExecutionId
{
select firstonly forupdate QueryPacked, RecId from printMgmtSettings
where printMgmtSettings.ParentId == staging.ParentId
&& printMgmtSettings.PriorityId == staging.PrintSettingPriorityId;
if (printMgmtSettings)
{
printMgmtSettings.QueryPacked = staging.QueryPacked;
ttsbegin;
printMgmtSettings.doupdate();
ttscommit;
}
}
}
when you exporting entity and download the package you will have one extra file in that package folder with name : Resource
here in this Resource folder for each record we have one file with querypacked field data.
No comments:
Post a Comment