Hi Kim,
The invoice you are referring is not the Invoice Contract right?
Check this out.
garethtuckercrm.com/.../service-contracts-service-scheduling-in-microsoft-crm-2011
www.magnetismsolutions.co.nz/.../Resolving_a_Case_in_Dynamics_CRM_2011.aspx
There is always a difficulty to retrieve the billable time of the case since it will be stored in different entity, not in the Case itself, it is stored in the case resolution and also as activity in CRM with type - Case Resolution. And this entity you cannot link to Invoice (this case resolution cannot have custom relationship and will not be possible to create workflow on it)
Yes, you will need plugin since you cannot use workflow to get the billable time. You only can trigger the workflow once Case is changed the status, but you cannot get the billable time from here, so you need workflow.
You register your plugin once the Case is changed the status or once the IncidentResolution entity is created.
How you create the Invoice?
Manual or Auto?
I'd suggest manual, because you don't want to make the users confused that the system has created an invoice everytime the Case is solved, right?
If I were the users, I'd prefer to create a new invoice from the Case I selected by myself.
If manual, then I would suggest you another way.
And also Plugin cannot help you to open the newly created Invoice (which is created from the System)
And also it makes the user confused, users have to go through one by one go to the Invoice records to continue the work.
I'd prefer once I resolved the Case, then I go to the Invoice record under this Case and also, one Case, it is possible to create more than once Invoice, you can also split the bill or one invoice failed, then create another invoice, right?
It is also thinking about the business functionality process, not only the technical side.
If manual then,
1. First, of course you need to create a relationship between Case and Invoice. From Invoice, create a lookup field or N:1 Relationship to Case
2. Then you customize the Form of the Invoice to create a new field: Billable Time of the Case
3. Using JavaScript, with the help of OData Query, you can retrieve the Case Billable Time through this way : You get the Lookup Id of the related Case in the Invoice Form --> Get the Case Resolution of this case --> Get the billable time from the Case Resolution.
OData Query you can check here:
http://missdynamicscrm.blogspot.com/2014/10/tips-and-trick-odata-crm-2011-2013.html
So how it works in the business process.
After the users resolve the case, then can still in the Case Form, go to the relationship explorer (in the left for CRM 2011 and there is a chevron upside on the top for CRM 2013/2015) or you can create a subgrid on this case form (to the related Invoice), then the user create a new Invoice under this case.
That is how your script will work, to retrieve the billable time once the Invoice Form is loaded and the Invoice is linked to the Case there.
I hope this can help you!
Thanks.