Skip to main content

Posts

Showing posts from September, 2018

Send to Azure Service Bus in #MSDyn365FO

Sending a message to Azure Service Bus is really simple in FinOps. Below is the job I wrote to send a message to the service bus. It takes a connection string and a queue name for connecting. The message string and key value pair list can be supplied to the properties. static str connectionString = 'Endpoint=sb://navaxservicebus.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=h5KwXSEFIHxxxxxxxxxxxxxxxxxx'; static str queueName = 'navaxqueue'; /// <summary> /// Runs the class with the specified arguments. /// </summary> /// <param name = "_args">The specified arguments.</param> public static void main(Args _args) { if (connectionString && queueName) { Microsoft.ServiceBus.Messaging.QueueClient queueClient = Microsoft.ServiceBus.Messaging.QueueClient::CreateFromConnectionString(connectionString, queueName); Microsoft.Ser

Alternate way to print a report as a byte array via X++ in #MSDyn365FO

Earlier this month I posted on how to print a report as a byte array . I will do the same but using an alternative method. I will use the print archive instead. You need to create an extension class for the SRSPrintArchiveContract class to add a parm method for the RecId. [ExtensionOf(classStr(SRSPrintArchiveContract))] final class SRSPrintArchiveContract_NAVAX_Extension { public RefRecId navaxPrintJobHeaderRecId; public RefRecId parmNAVAXPrintJobHeaderRecId(RefRecId _navaxPrintJobHeaderRecId = navaxPrintJobHeaderRecId) { navaxPrintJobHeaderRecId = _navaxPrintJobHeaderRecId; return navaxPrintJobHeaderRecId; } public RecId savePrintArchiveDetails(container binData) { RecId recId = next savePrintArchiveDetails(binData); this.parmNAVAXPrintJobHeaderRecId(recId); return recId; } } This is the alternative method I wrote. public static str printSalesInvoiceBase64StrV2(SalesInvoiceId _salesInvoiceId) {

Gotcha with Extending Retail Channel transaction table

I will start by pointing you to a good article Andreas Hofmann from Microsoft has written. It steps you through what you need to extend a transactional table in the Retail Channel and bring that back to HQ via the P Job. https://dynamicsnotes.com/extending-a-transactional-retail-channel-table-with-additional-data-hq-x-table-extension-cdx-extension-table-crt-data-service/ Now to summerise the issue I faced recently (being a retail rookie). Following the blog post I created a custom Int64 field on the RetailTransactionSalesTrans. However, when I ran the P job it failed with this error. “Failed to convert parameter value from a String to a Int64” I did some investigation by trying to find out what it is actually doing. Essentially the job will do an outer join to your custom extension table. Even though your custom field is 0 by default. You won’t be creating an extension record for every single transaction record. The p job will do an outer join between RetailTransactionSalesTrans to you

Print a report as a byte array via X++ in #MSDyn365FO

In the last post I showed how to print the sales invoice as a pdf. In this post we will do the same but generate a byte array of the pdf report. I tried to make the code as readable as possible and hopefully can use it on other reports.. public static str printSalesInvoiceBase64Str(SalesInvoiceId _salesInvoiceId) { str ret; CustInvoiceJour custInvoiceJour; select firstonly custInvoiceJour where custInvoiceJour.InvoiceId == _salesInvoiceId; if (custInvoiceJour) { str ext = SRSPrintDestinationSettings::findFileNameType(SRSReportFileFormat::PDF, SRSImageFileFormat::BMP); PrintMgmtReportFormatName printMgmtReportFormatName = PrintMgmtDocType::construct(PrintMgmtDocumentType::SalesOrderInvoice).getDefaultReportFormat(); SalesInvoiceContract salesInvoi

Print a Sales Invoice via X++ in #MSDyn365FO

Often you want to print a report via X++. One of the more common reports is the sales invoice. Below is some code you could use to download a pdf copy. I am just picking the first invoice and printing to pdf. Next few posts will be dependent on this. I will try to build up the scenario. public static void printSalesInvoice() { CustInvoiceJour custInvoiceJour; select firstonly custInvoiceJour where custInvoiceJour.SalesId != ''; if (custInvoiceJour) { str ext = SRSPrintDestinationSettings::findFileNameType(SRSReportFileFormat::PDF, SRSImageFileFormat::BMP); PrintMgmtReportFormatName printMgmtReportFormatName = PrintMgmtDocType::construct(PrintMgmtDocumentType::SalesOrderInvoice).getDefaultReportFormat(); SalesInvoiceContract salesInvoiceContract = new SalesInvoiceContract(); salesInvoiceContract.parmRecordId(custI