Показать сообщение отдельно
Старый 02.07.2019, 17:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
ievgensaxblog: MSDyn365FO. How to Import CSV file using Electronic Reporting. Part 5 – Run import from X++ code.
Источник: https://ievgensaxblog.wordpress.com/...t-from-x-code/
==============

In previous 4 parts I showed how to build new format without a line of X++ code, but unfortunately to run it you must go to ER workspace. However, it is possible to run it from X++ as well, code below could be easily invoked from a new button to give users better experience.

var runner = ERObjectsFactory::createMappingDestinationRunByImportFormatMappingId(_mappingId, _integrationPoint);runner.withParameter(inputParameters); //optional, to pass parameters if requiredrunner.run();MappingId is import format configuration. Usually, you have a parameter where a user can select configuration, for example, import format configuration field on bank statement format table.

IntegrationPoint is a string value that you populate on the model mapping designer screen:



Usually, format is classStr(ERTableDestination) + ‘#’ + tableStr(TargetTable)

InputParameters is an instance of ERModelDefinitionDatabaseContext class, where you can add parameter name and value pairs:

ERmodelDefinitionInputParametersAction inputParameters = new ERmodelDefinitionInputParametersAction();inputParameters.addParameter('$ExecutionID', _executionID).addParameter('$AccountId', bankAccount);

Источник: https://ievgensaxblog.wordpress.com/...t-from-x-code/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.