The type of the field Invoice Layout\Total is incompatible with a Check Sum rule. System.InvalidCastException: Specified cast is not valid
appears after changing the type of the "Total" field from "Number" to "Amount of Money" in the invoice project.
This issue appears because of the incorrect conversion in the
Invoice Layout\Total script rule.
The solution for this behavior is the modification of the
Invoice Layout\Total script rule. By default, the type of the
total variable in this script is
double total = (double)( Context.Field("Total").Value );
This is causing the conversion error because the type of the "Total" field is now "Amount of Money". In order to fix it, please change the type of the total variable from
decimal total = (decimal)( Context.Field("Total").Value );
Please sign in to leave a comment.