Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Blogs / Day to Day Dynamics 365 / Dynamics 365 Project Servic...

Dynamics 365 Project Service Automation: Invoicing - Using Batch Jobs with Invoice Frequencies

apa Profile Picture apa 8,280

Tested on:
Dynamics 365 version 9.0


Invoice Frequencies provide a very convenient way of scheduling invoices in Dynamics 365 Project Service Automation. There is, however, very specific logic about how they work on both Time and Material and Fixed Price contract lines. While this post isn't meant to cover the different aspects of Project Contract (I covered Project Contract in a video blog), it's important to define a scenario for using Batch Jobs. In this example I'm using the following combination of Time, Expense and Fee on Time and Material and Fixed Price contract lines:

Billing Method Include Time Include Expense Include Fee
Time and Material Yes Yes No
Fixed Price No No Yes



The reason I've selected this combination is based on the following details:

  • T&M contract line with Include Time and Include Expense set to Yes: Allows me to log Time and Expense via the Time/Expense Entry Form. Both Cost and Unbilled Sales Actuals are created meaning I will get a cost and a sales price for Time and Expense transactions.
  • T&M contract line with Fee set to No: Fees can not be invoiced when using T&M.
  • FP contract line with Include Time and Include Expense set to No: Time and Expense can not be invoiced when using FP.
  • FP contract line with Fee set to Yes: Allows me to invoice Fees by using Periodic Milestones (these are called Invoice Schedule on T&M lines).


Why Batch Jobs have to be used with Invoice Frequencies

Analyzing the difference of the operating logic between T&M and FP contract lines reveals the need for Batch Jobs in invoicing. While FP contract lines always require an Invoice Frequency with created Periodic Milestone(s) to create an invoice, the logic of T&M contract lines differs significantly. When T&M contract Lines are used and the "Create Invoice" button is clicked on the Project Contract's ribbon, an invoice is created. This invoice pulls all approved Time and Expense Entries on the invoice despite a set Invoice Frequency, its Invoice Schedule (on T&M lines this is called Invoice Schedule as opposed to FP's Periodic Milestone) or Transaction Cut Off Dates. In other words the only way to make T&M contract lines honor Invoice Frequencies and their Invoice Schedules is by using Batch Jobs.


Setting up a Batch Job

Batch Jobs are relative easy to set up. An important detail to remember is that the on-demand workflow "ProcessRunner" that actually creates an invoice has a condition If Batch Job:Name contains [Create Invoices]. I tried naming my Batch Job Create Invoice - without the s - and an invoice was never created.

5127.1.png


Setting Invoice Schedules and Periodic Milestones

There are a couple of important details to note when setting up Invoice Schedules (T&M lines) and Periodic Milestones (FP lines):

  • Approved Time and Expense entries are rolled up to the invoice up until Transaction Cut Off Date - 1. Approved entries that are entered for the same date as the Transaction Cut Off Date will not be rolled up to the invoice.
  • Periodic Milestones (FP lines) must be set as Ready for invoicing in order for them to be rolled up on the invoice.

5811.2.png



5432.3.png


Demo

I have submitted and approved Time and Expense entries for various dates. As the photos in this post illustrate I have both a T&M and a FP contract line created with an Invoice Frequency set for 1st of month billing. On the T&M line the Transaction Cut Off Date is 30.11.2017 and the Invoice Run Date is 1.12.2017. This means that approved Time and Expense entries logged up to 29.11 will be included on the invoice that the Batch Job creates. For the FP contract line the first Milestone Date is 1.12.2017 so that specific Milestone will also be included on the invoice.

The following Time and Expense entries have been submitted and approved.

1732.4.png

1007.5.png

1104.6.png


The next task is to run the Batch Job. As I want to run the Batch Job immediately, I'm choosing the on-demand workflow "ProcessRunner". The logic behind it is Process, Sleep, Process, Sleep vs. Sleep, Process, Sleep, Process of "ProcessRunCaller". These are the two workflows which actually create the invoices and ProcessRunner does the actual invoice creation (Microsoft, 2017).

Keep in mind that there is to be only one instance of ProcessRunner / ProcessRunCaller in the system. Multiple processes may result in duplicate invoices. Please see here for more information.

0268.7.png


The Milestone status on the T&M line changes to Run Successful after the workflow has run. The FP line was manually set to Ready for invoicing.

4527.8.png


The last step is to compare the Active Invoice Line Details with what was submitted and approved. All entries up to 29.11 are correctly on the invoice.

3060.9.png


I hope this small guide enables you to take more out of invoicing in Dynamics 365 Project Service Automation. My big thanks goes to the PSA PG at Microsoft for providing additional details on creating Batch Jobs.


Disclaimer: 
All my blog posts reflect my personal opinions and findings unless otherwise stated.


Edits:
July 3rd 2018. Added information about ProcessRunner / ProcessRunCaller with a link to another article.

Comments

*This post is locked for comments