locked
"PRINT Plugin" for Invoice Table RRS feed

  • Question

  • Hi There, I want to create a plugin to Print an Invoice if a "new_printInvoice" field is true upon Invoice Creation. I have some basic knowledge of plugins but don't know how I can get access to Print Command through Plugin? or How Can I trigger Print Command through Plugin if "new_printInvoice" is true? Please help. Thanks in advance.. Kind Regards, M. Khan
    Sunday, April 25, 2010 8:51 AM

Answers

  • Print is pretty much a client action, while plug-in is solely a server-based technology, they don't actually fit together. 

    If you do print in plug-in code, it's going to be happening in the server-side, and it's a very expensive thing for the server. Also printing from server side means that you are not going to be able to reuse CRM print feature, you will need to render the print page by yourself. 

    An alternative option would be create another field called new_printed, which is a read-only field on the form, its value is default to false. When the invoice has been created and saved first time, you will use JavaScript to prompt your CRM user to print it. After it's been printed, you can set the field's value to true, so it won't be prompted again. But there is no guarantee that your CRM user will open the new invoice record after it has been created and saved first time. 

    One more option is to write Windows Service code to automate the print, it doesn't have to be on the CRM server, it could be running on any desktop or another server that can talk to the CRM server, so that it doesn't affect the CRM server performance. The Windows Service code periodically pull from CRM server to check for new invoice records, and print it automatically when new invoice arrives. 

    Not much other choice, in my opinion. 

    Just my 2 cents, hope this helps. 


    Daniel Cai | http://danielcai.blogspot.com
    Sunday, April 25, 2010 6:15 PM

All replies

  • It depends on what type of document your Invoice is (i.e Word Document, SSRS report, etc..) The other item to be aware of is that your users will have their printers installed locally so you would have to identify which printer/printers to print to on your network from the server if you wanted server side print. Is it not possible to present the user with the option to choose to print the invoice, as that ability woulde still need to exist as you may need to reprint an invoice in the future.
    MSCRM Bing'd - http://bingsoft.wordpress.com
    Sunday, April 25, 2010 2:34 PM
    Moderator
  • Many thanks for response. Well, I just want to trigger default Print Command under INVOICE section of CRM with default layout (if "new_printInvoice" field is true). Is there any way to do this through Plugin?

    Thanks Again.

    Sunday, April 25, 2010 5:39 PM
  • Print is pretty much a client action, while plug-in is solely a server-based technology, they don't actually fit together. 

    If you do print in plug-in code, it's going to be happening in the server-side, and it's a very expensive thing for the server. Also printing from server side means that you are not going to be able to reuse CRM print feature, you will need to render the print page by yourself. 

    An alternative option would be create another field called new_printed, which is a read-only field on the form, its value is default to false. When the invoice has been created and saved first time, you will use JavaScript to prompt your CRM user to print it. After it's been printed, you can set the field's value to true, so it won't be prompted again. But there is no guarantee that your CRM user will open the new invoice record after it has been created and saved first time. 

    One more option is to write Windows Service code to automate the print, it doesn't have to be on the CRM server, it could be running on any desktop or another server that can talk to the CRM server, so that it doesn't affect the CRM server performance. The Windows Service code periodically pull from CRM server to check for new invoice records, and print it automatically when new invoice arrives. 

    Not much other choice, in my opinion. 

    Just my 2 cents, hope this helps. 


    Daniel Cai | http://danielcai.blogspot.com
    Sunday, April 25, 2010 6:15 PM