Показать сообщение отдельно
Старый 06.06.2018, 21:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
How to add a new report for a business document in D365
Источник: http://alexvoy.blogspot.com/2018/06/...-business.html
==============

My colleague Rod showed it to me when I needed to add a new report to Project Invoice Proposal with billing rules to be present in Print management settings.


///
/// Subscribes to print mgmt report format publisher to populate custom reports
///
[SubscribesTo(classstr(PrintMgmtReportFormatPublisher), delegatestr(PrintMgmtReportFormatPublisher, notifyPopulate))]
public static void notifyPopulate()
{
#PrintMgmtSetup

void addFormat(PrintMgmtDocumentType _type, PrintMgmtReportFormatName _name, PrintMgmtReportFormatCountryRegionId _countryRegionId = #NoCountryRegionId)
{
avrPrintMgtDocType_ProjInvReport_Handler::addPrintMgmtReportFormat(_type, _name, _name, _countryRegionId);
}

addFormat(PrintMgmtDocumentType::SIProjInvoiceWithBR, ssrsReportStr(avrPSAContractLineInvoice, Report));
}

///
/// Adds a report format to the printMgtReportFormat table
///
/// PrintMgmtDocumentType value
/// Name of the report (ie. reportname.Report)
/// Description of the report (ie. reportname.Report)
/// Country or default (#NoCountryRegionId)
/// True if this is a system report
/// SSRS report or another type
private static void addPrintMgmtReportFormat(
PrintMgmtDocumentType _type,
PrintMgmtReportFormatName _name,
PrintMgmtReportFormatDescription _description,
PrintMgmtReportFormatCountryRegionId _countryRegionId,
PrintMgmtReportFormatSystem _system = false,
PrintMgmtSSRS _ssrs = PrintMgmtSSRS::SSRS)
{
PrintMgmtReportFormat printMgmtReportFormat;

select firstonly printMgmtReportFormat
where printMgmtReportFormat.DocumentType == _type
&& printMgmtReportFormat.Description == _description
&& printMgmtReportFormat.CountryRegionId == _countryRegionId;

if (!printMgmtReportFormat)
{
// Add the new format
printMgmtReportFormat.clear();
printMgmtReportFormat.DocumentType = _type;
printMgmtReportFormat.Name = _name;
printMgmtReportFormat.Description = _description;
printMgmtReportFormat.CountryRegionId = _countryRegionId;
printMgmtReportFormat.System = _system;
printMgmtReportFormat.ssrs = _ssrs;
printMgmtReportFormat.insert();
}
}


Then I can pick it up in Print management settings in Project module.



It may be a good idea to delete records from PrintMgmtReportFormat table; all its records will be recreated the next time you open Print management form.




Источник: http://alexvoy.blogspot.com/2018/06/...-business.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.