Aaron Berquist Rotating Header Image

Contract Administration

In Praise of FieldService, Or: Product 949, You Sure Are Fine

Having spent the better part of my career working with Dynamics GP, I’ve had the pleasure of working with most of the core modules, and a number of 3rd party applications as well. By far and away, my favourite module to work with has been the FieldService module, and more specifically, the Contracts Administration portion of it. I find it’s well designed, well written, and very easy to enhance and extend when the need for custom business processes dictates.

After reflecting on why it is I find this to be my favourite module, it comes down to the fact that so much of it is based on SQL stored procedures. This fact alone has enabled us to make some very useful and powerful changes to the behaviour of certain parts of the module in a fairly easy and straightforward manner. Some of the changes we’ve made by modifying certain stored procedures are:

  1. Create SOP orders with a series of items, then create contractible items based on those items. (Procedure modified: SVC_Create_Cont_Line_From_SOP)
  2. Automatically create/change/delete items on a contract at renewal time. (Procedure modified: SVC_Contract_Renew)
  3. Repurpose certain fields and tables for other uses (Procedure modified: SVC_Create_Cont_Line_From_SOP).
  4. Eliminate contracts from appearing in the Contract Move screen based on certain criteria (Procedure modified: SVC_Create_Contract_Move_WORK)

In most cases, a combination of modifying the stored procedure, plus some “light” VBA coding is all that’s required to implement the custom business logic we require. It would be fantastic if other modules implemented more of a “stored procedure” based approach.

In short, for the developer who does not know Dexterity, the implementation of the FieldService module, with it’s heavy use of SQL stored procedures, makes it pretty straightforward to enhance the application in a rapid and efficient way.

Post to Twitter

Tool for Improving “Mark All” Speed in Contract Administration

One of my users complained recently that, when using the “Mark All” button on the Revenue Recognition screen in Contract Administration (Dynamics GP: Transactions: Contract Administration: Revenue Recognition), it would sometimes take 6-8 hours for the process to complete. This was not to post the revenue, merely to mark all of the records in the window for processing.

Now, in some of our larger company databases, over 30,000 records were being marked to process, due to a combination of:

  • # of contract records
  • the business process of recognizing multiple months worth of revenue

Clearly, this is not an acceptable amount of time to wait for a process to complete. I arranged to do a SQL trace while the user clicked the “Mark All” button. I found that the Revenue Recognition window would run a SQL stored procedure (SVC_Check_Contract_Revenue) for every contract record in the window to determine if the contract was “Marked to Post” by another user. If so, a message would display, alerting the user to the fact that another user had a record marked to post. Technically, the code was:

  • examining the SVC00625 table (SVC_Contract_Revenue_WORK)
  • looking at each contract/fiscal period combination to see if another user also had that contract/fiscal period record marked to post (MKDTOPST = 1).

The key thing I found was that this routine was being run row-by-row, one record at a time. Even though the check was very quick to complete for any one given record, the number of records it had to check added up to the 6-8 hours I mentioned earlier. Fortunately, I was able to devise a solution to this issue. In reality, my users did not care if someone else posted the record, and did not need to know which contract in question was going to be posted by someone else. It was enough for them to know “Hey – some of the records you want to mark are currently marked by someone else. I’m going to skip marking those particular records, and just mark the ones that are safe to post.” By taking this approach, I could craft a routine which would work on ALL records at once, which was orders of magnitude faster.

The solution I devised to this problem involved 4 components:

  1. I modified the Revenue Recognition window to add my own “Mark All” and “Unmark All” buttons. I hid and disabled the actual “Mark All” and “Unmark All” buttons in Modifier.
  2. I created a custom stored procedure (X_OT_SVC_REVREC_MARK_UNMARK_ALL) to mark all/unmark all records to post. It will skip any records marked by other users, and raise an alert if any are found.
  3. I added VBA to the window which will call the procedure when either of the buttons are clicked.
  4. I noticed that the window did not refresh to show the buttons as checked/unchecked after the stored procedure was run. I also noticed that if I clicked the “down” arrow on the keyboard, the line would refresh. So, I recorded a macro of pressing “down” 16 times (as that’s the number of rows that show in the window) which is then called from the VBA code.

If you’re experiencing slow performance when marking/unmarking all, try using the code pack below to implement this solution in your environment (test first!). Instructions on how to install are included, as there are a few tweaks you will have to make based on how your environment has been crafted. If you have questions, or if this solution helps you out, please leave a comment below!

Download the package here: Enhanced Mark All Revenue Recognition Routine.zip

Post to Twitter