web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Mexico Electronic Invoicing - Error when Requesting Stamp

(1) ShareShare
ReportReport
Posted on by

Hello,

I'm trying to use the Mexican localization for Electronic Invoicing, and when I try to Request the Stamp for a posted invoice, I'm getting the following error message:

Microsoft Dynamics NAV
---------------------------

A call to Microsoft.Dynamics.Nav.MX.SignatureProviders.CFDISignatureProvider.SignData failed with this message: Object reference not set to an instance of an object.
---------------------------
OK
---------------------------

I can see that the system is finding my Certificate because if I change the Thumbprint for my certificate, the error message will be different (Could not find a valid certificate in the local machine certificate store).

Can somebody please enlighten me or let me know how to get in touch with MS regarding this?

Thanks, regards,

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Alexander Ermakov Profile Picture
    28,096 on at
    RE: Mexico Electronic Invoicing - Error when Requesting Stamp

    First thought is that the system either is not finding the needed Dynamics.NAV.MX dll (it might be not installed or properly registered), or there is an error while you connect to your PAC. I'm not much aware of Mexican localization, how had you setup the connection to PAC? NAV communicates with PAC using web services to request a stamp, so there might be incorrect setup of the web service, or even your firewall settings or malware protection restricts that...

  • Community Member Profile Picture
    on at
    RE: Mexico Electronic Invoicing - Error when Requesting Stamp

    Hey Alexander,

    I really appreciate your answer.

    From my experience with .NET programming, this error (Object reference not set to an instance of an object) usually happens when you declare an object and you try to use it before assigning an instance of it.

    So, from the tracing that I do on the codeunit, the needed DLL is being properly found, and it's being initialized correctly on Navision.

    But I'm thinking there maybe a programming error, or issue within it, and since I don't have the source code for such DLL, there's nothing much I can assess of a possible error :(

    I've followed all the steps on setting up the localization, accordingly to Microsoft's Localization instructions guide, and I'm still clueless :(

    Thanks for giving any ideas!

  • Suggested answer
    Alexander Ermakov Profile Picture
    28,096 on at
    RE: Mexico Electronic Invoicing - Error when Requesting Stamp

    I still have suspects that there might be something wrong with the web service setup. Can you troubleshoot, do you get this error as a response while accessing PAC's side or before? How do you setup this service? Is the link accessible from your environment?

  • Silvano Mendoza Profile Picture
    119 on at
    RE: Mexico Electronic Invoicing - Error when Requesting Stamp

    Hello Marcelo, these DLLs came out for issuing a base64 stamp in combination of a certificate and text strings. Microsoft build that file generation (xml e-invoice)), strings and so on.

    I can understand few issues in your inquiry, first the DLL: depending in the version of NAV (i assume you are running RTC) I can suggest to make sure the DLL is in the server tier and installed in the GAC system folder of that server, and when you define variables don't set the property RunOnClient to true. if you are running newer versions of NAV it should already be in the Add-ins folder. for classic client you need to register the dll and install them on each computer.

    I remember we made that running out of the box. besides that there are other dll to build the QR code but before I go more technical I rather say that the QR is the short version of the official QR local treasury requests. we purchased our own visual studio project to do the QR. I'm assuming you are trying to use this for a company that needs to issue e-invoices within mexico, if you just need the stamping for other things I recommend you just to find an installation package in the installation media of the northamerican localization for NAV

    secondly If you do need this to issue e-invoices for a Mexican business , you need to install the end customers certificate in the trusted and personal certificate warehouses for each computer as I remember and use the thumbprint.

    finally, I would say you have other choices than building the whole file which will take some time. PACs in mexico, as Aleksander said, have webservices and connectors, you can just transmit the xml without many of the heading attributes and get a official e-invoice ready to attach to a sales invoice header.  (as you know, you must go through PAC to issue official invoices, they will return the same file you sent but with extra xml elements - did I mention you need to pay few cents each stamp?)

    the webservice part might not work out of the box from MS as the soap for PACs is not standardized , I meant each PAC creates its own xml nodenames, number of xml elements and so on. you always need to modify the webservice call and response. not mentioning that a XML e-invoce comes along a PDF (with specific mandatory data). I work for a NAV solution center in the Mexican Caribbean, if I can be of any help with code or DLLs you can write here. we did a lot for electronic invoicing.

  • Silvano Mendoza Profile Picture
    119 on at
    RE: Mexico Electronic Invoicing - Error when Requesting Stamp

    I forgot to mention that in two months the new version of e-invoice for mexico will change, so in your development look at the latest release of the local treasury  (SAT), many attributes changed and instead of text , snow there are a bunch of catalogs to go by codes instead of free text. that release is called CFDI version 3.3.

  • Community Member Profile Picture
    on at
    RE: Mexico Electronic Invoicing - Error when Requesting Stamp

    Hi,

    Did you find out what was causing this issue? i am having the same problem.

    Thanks in advance1

  • Dmytro Profile Picture
    15 on at
    RE: Mexico Electronic Invoicing - Error when Requesting Stamp

    Hi all,

    So did you get any progress?

    I have the same issue ("Could not find a valid certificate"). But since I can generate QR codes (it's located in the same DLL) I'd assume it's not about dll's installation.

    Thanks!

    Dmytro

  • TitanioJose Profile Picture
    40 on at
    RE: Mexico Electronic Invoicing - Error when Requesting Stamp

    Hola Dmytro, Pudiste resolver el problema?

    Me he topado con el mismo problema, y se me agotaron las ideas para solucionar, espero me puedan orientar.

    Saludos

  • Silvano Mendoza Profile Picture
    119 on at
    RE: Mexico Electronic Invoicing - Error when Requesting Stamp

    there are a number of things you need to install, a certificate for instance in your certificate warehouse. But i want to warn if you are using these dll provided for NAV 2009 or NAV 5, or nav 2013 , you will not get a SHA-256 bits encryption signature. For older versions of NAV where no longer support is, you need to do it in a dll or program out of NAV. I did my own dll's for NAV 2009 classic and RTC within C#, then i call the dll to do the signature and another dll to do the QR, as the standard QR provided is the simplified version of QR and you cannot store big images in a Blob field.

    i used that QR for a local project some years ago and it will look like this:

    qrnew.JPG

    but for the new electronic invoice you need a bigger size and the signature is different (since new SAT certificates are 256 bits)

    qrnew.JPG

    i used my dll to generate a QR in the new size and with all the mark of a full QR, then i save it as jpg , after i convert it in the fly to a bmp in order to import it to NAV and decrease file size since you cannot load a big file in a BLOB (you need to modiy code in NAV so you need a developer ). it will look blurry if you dont compress it well

    qr-new-2.JPG

    another thing you can do is to find a PAC that does the PDF for you with a webservice after making the signature of the eInvoice. It is not so difficult to make a QR Code assembly in C# as there are some projects in the web to create your own libraries for barcodes, just some research. But the QR code sould be 2.75 cm each side and has to contain data of your invoice so when you scan it you will be redirected to a website of SAT to validate it is not a fake eInvoice.

    saludos

    Silvano

  • TitanioJose Profile Picture
    40 on at
    RE: Mexico Electronic Invoicing - Error when Requesting Stamp

    Estoy utilizando NAV 2018. Dicha versión ya incluye la factura electrónica.

    Del lado de NAV se configura la huella digital, y otros datos fiscales, posteriormente se envía un XML al PAC para hacer el timbrado y regresar.

    Mi problema viene al momento de Solicitar el Sello, pues arroja el error "Microsoft.Dynamics.NAV.SignatureProviders.CFDISignatureProvider.SignData", corro el depurador y me indica que no hay Huella Digital, pero dicha huella si existe en el campo de configuración de contabilidad. Si quito el dato, el mensaje de error es otro.

    Una opción es implementar un desarrollo que ya se tiene, sólo se adapta a la versión de NAV deseada, pero estoy analizando el potencial de esta funcionalidad nata de NAV, y determinar que su uso es viable, o justificar por que aún no usarlo.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

#1
Alexander Ermakov Profile Picture

Alexander Ermakov 2

#2
SC666 Profile Picture

SC666 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans