Skip to main content

Posts

Debug Modern POS using .NET Reflector

Respect to all those POS developers. It really requires some dedication and focus to be a POS developer. This is an example of something I would have not figured out without my colleagues. We were working on a development project and we struggled to make sense out of the error. The error we got was complaining about the a method to validate the Unit of measure and Quantity. I was sure the object was not null and I had passed the right thing to it. Unit of measure and quantity fields were populated correctly. The modification was overriding the price. System.NullReferenceException was unhandled by user code    HResult=-2147467261    Message=Object reference not set to an instance of an object.    Source=Microsoft.Dynamics.Commerce.Runtime.Workflow    StackTrace:         at Microsoft.Dynamics.Commerce.Runtime.Workflow.CartWorkflowHelper.ValidateCartLineUnitOfMeasureAndQuantity (RequestContext context, Cart newCa...

Send file to temp blob storage in #MSDyn365FO

In this post I will talk about sending a file to a temporary blob storage. A little warning before I get into it. This is using the Microsoft’s blob storage that is provisioned for us. I haven’t given it a lot of thought on how it would behave in production. Take it at your own risk. Lets start by looking back on a couple of posts last month on printing a report to a byte array. http://dynamicsnavax.blogspot.com/2018/09/print-report-as-byte-array-via-x-in.html http://dynamicsnavax.blogspot.com/2018/09/alternate-way-to-print-report-as-byte.html You can use those sample pieces of code to get a report as a stream and send it to the below code. if (stream) { str fileName = 'myfile'; str contentType = 'application/pdf'; str fileExtension = SRSPrintDestinationSettings::findFileNameType(SRSReportFileFormat::PDF, SRSImageFileFormat::BMP); FileUploadTemporaryStorageStrategy fileUploadStrategy = new FileUploadTemporaryStorageStrategy(); FileUploadTemporarySto...

Find TableId using table browser #MSDyn365FO

I am usually doing this from the development environment. However, I was debugging a customer environment where I only had access to the front end. I had a table that only gave me the RefTableId. I needed to find out the table that record related to. I used SysTableIdView from table browser. Here is the link. http://usnconeboxax1aos.cloud.onebox.dynamics.com/?cmp=usmf&mi=SysTableBrowser&TableName=SysTableIdView

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...