I had gone through some of your videos regarding 'Electronic Reporting' in d365 fo . I am trying to do a Electronic report but I'm getting an error.
I’m working on a custom Electronic Reporting (ER) format that I’m triggering from X++ using a service, controller, and contract class. The report should receive user input parameters (ItemId and InventBatchId) from the contract and pass them to the ER model mapping at runtime. This Electronic report is triggered through a 'custom button' from batches form in d365 fo . Is there anything I'm missing in the setup or configuration or in code level.
But I am getting this error continuously that '“Parameters for model Customer Label(my model name) have not been found" .
public class IIT_PrintCustomerLabelERContract extends ERFormatMappingRunBaseContract
{
ItemId itemId;
InventBatchId inventBatchId;
public ItemId parmItemId(ItemId _itemId = itemId)
{
itemId = _itemId;
return itemId;
}
public InventBatchId parmInventBatchId(InventBatchId _inventBatchId = inventBatchId)
{
inventBatchId = _inventBatchId;
return inventBatchId;
}
Service class code
class IIT_PrintCustomerLabelERService extends SysOperationServiceBase
{
public const str ERModelDataSourceName = 'Customer Label';
public const str DefaultExportedFileName = 'Stadler Customer Label Report';
public const str ParametersDataSourceName = 'User input parameters';
public static ERFormatMappingId getFormatMapping()
{
return (select ERFormatMappingTable where ERFormatMappingTable.Name == 'Stadler Part1').RecId;
}
{
ERFormatMappingId formatMappingId;
formatMappingId = IIT_PrintCustomerLabelERService::getFormatMapping();
if(formatMappingId)
{
try
{
ERIModelDefinitionParamsAction parameters = new ERModelDefinitionParamsUIActionComposite().add(new ERModelDefinitionObjectParameterAction(ERModelDataSourceName, ParametersDataSourceName, _contract, true));
ERIFormatMappingRun formatMappingRun = ERObjectsFactory::createFormatMappingRunByFormatMappingId(formatMappingId);
formatMappingRun.withParameter(parameters);
formatMappingRun.parmFileName(DefaultExportedFileName);
formatMappingRun.withFileDestination(_contract.getFileDestination());
formatMappingRun.parmShowPromptDialog(false);
formatMappingRun.run();
}
catch
{
error("An error occurs while generating the report");
}
}
else
{
Warning("No format mapping found");
}
}
Controller
{
public static void main(Args args)
{
IIT_PrintCustomerLabelERController operation;
IIT_PrintCustomerLabelERContract contract;
operation = new IIT_PrintCustomerLabelERController(classStr(IIT_PrintCustomerLabelERService), methodStr(IIT_PrintCustomerLabelERService, executeOperation), SysOperationExecutionMode::Synchronous);
contract = operation.getDataContractObject();
operation.parmShowDialog(true);
operation.startOperation();
}
{
ClassDescription batchDescription;
batchDescription = "Customer label ER Report";
return batchDescription;
}
Regards,
Charan.


Report
All responses (
Answers (