Solution for "Specified cast is not valid" error

The chain of events usually are:

Load Peachtree or Sage 50
Via AyaNova -> select Plugins main menu -> PTI
Via PTI’s Map & Import, imported AyaNova clients into Peachtree or Sage 50
May or may not already set AyaNova workorders for clients that were just imported that are ready for invoicing before or after the above steps
Via PTI, displays workorders for clients ready for invoicing
When select to invoice for AyaNova clients that were just imported into your Peachtree or Sage 50 database, may get the error message:

Invoicing completed with some errors:
Invoice: Invoicing failed due to the following error:
Specified cast is not valid.

What’s happening:

The error occurs because the AyaNova client imported does not yet have its Sales Tax set in your Peachtree or Sage 50.
And when you do set it so, you MUST refresh the Peachtree connection before PTI can see this change

Solution:
Exit out of the error.
Exit out of PTI
In your Peachtree or Sage 50, set the Sales Tax for each AyaNova client just now imported (especially for the clients you are attempting to invoice via PTI of course!)
Now select the Plugins main menu in AyaNova -> AyaNova PTI -> Refresh Peachtree conneciton (very important that this step be done)
Now load PTI again, and now you can invoice.