Skip to main content
Solved

Using Audit History to View Status Progression of Project Tasks

  • February 10, 2025
  • 5 replies
  • 62 views

Hi!
I’m wanting to use audit history to report on when a Project Task went from Active to Completed or Cancelled for example? 

Has anyone does this before, or can recommend the right table to use in a GI?

Best answer by Gabriel Michaud

@Caleb Harriott I worked on this on my flight back, and I adapted the solution to work with MySql. WIth the view and data access class you can create a generic inquiry, and easily pull this generic inquiry into Excel with Velixo if you want to analyze the data in Excel.

 

 

The SQL view adapted for MySql looks like this:

CREATE OR REPLACE VIEW ProjectStatusAuditHistoryView AS
SELECT 
    AuditHistory.CompanyID, 
    AuditHistory.batchID, 
    PMTask.ProjectID, 
    PMTask.TaskCD,
    SUBSTRING_INDEX(
        SUBSTRING_INDEX(
            REPLACE(ModifiedFields, CHAR(0), '~'), 
            'Status~', -1
        ), 
        '~', 1
    ) AS ModifiedStatus,
    AuditHistory.ChangeDate,
    AuditHistory.Operation,
    AuditHistory.UserID 
FROM 
    PMTask 
INNER JOIN 
    AuditHistory 
    ON PMTask.CompanyID = AuditHistory.CompanyID 
    AND AuditHistory.TableName = 'PMTask' 
    AND CONCAT(PMTask.ProjectID, CHAR(0), PMTask.TaskCD) = AuditHistory.CombinedKey
WHERE 
    REPLACE(ModifiedFields, CHAR(0), '~') LIKE '%Status~%';
GO

The customization project is attached to this message.

 

P.S. i’m using the standard PMProject.Status field, I recall from our discussion that you have a custom status field so the database view would need to be adapted to use this field instead, but otherwise the solution is workable...

View original
Did this topic help you find an answer to your question?

5 replies

nhatnghetinh
Captain II
Forum|alt.badge.img+11
  • Captain II
  • 523 replies
  • February 11, 2025

Hi ​@Caleb Harriott 

Please create a GI similar to Project Tasks GI available in Acumatica.

 

 

Add conditions as shown in the screenshot below (and you can add other conditions and edits as you like)

 

 

Best Regards,

NNT


Thanks NNT!
The only problem with that is it doesn’t tell me when the Status changed?
For example I’m wanting to look to see a timeline that breaks down
When it was first Active, when it became completed and potentially if it was made active again (for example it was made completed in error)

Any thoughts on how to achieve this?


nhatnghetinh
Captain II
Forum|alt.badge.img+11
  • Captain II
  • 523 replies
  • February 11, 2025

Hi ​@Caleb Harriott 

The LastModifiedDateTime field will record the time when the status changes.

 

 

However, the lastModifiedDateTime field only displays the time of the last change. Therefore, you must need Customization to record the time of Status (Active, Completed, Canceled) when the status changes.

I suggest another way to record the time of the Status without Customization. You create Business Events > When the status changes > import Activity into the Project Tasks screen > Activity creation time is the time to change the status of Project Tasks.

 

 

Then you can create GI of Project Tasks with Activities that record the time of Status (Active, Completed, Canceled) of Project Task.

 

Best Regards,

NNT

 

 


Gabriel Michaud
Captain II
Forum|alt.badge.img+11

Hi Caleb,

The data structure of the AuditHistory table doesn’t allow for easy querying/joining from a generic inquiry:

  • The CombinedKey field is a string, containing all the key fields separated by a null ‘0’ character
  • The list of changes is all encoded into a single field

Unfortunately, I couldn’t find a way to use the CHAR() function or any way to setup a join condition using the null character in Acumatica generic inquiries.

I see two ways to accomplish what you’re looking for:

  1. Create a SQL View, and DAC on top of it. The SQL view also needs to take proper care and replace the NULL character to another character before-hand. This SQL query works for me:
SELECT AuditHistory.batchID, PMTask.ProjectID, PMTask.TaskCD,
SUBSTRING(
	REPLACE(ModifiedFields, NCHAR(0) COLLATE Latin1_General_100_BIN2, N'~'),
	CHARINDEX('Status~', REPLACE(ModifiedFields, NCHAR(0) COLLATE Latin1_General_100_BIN2, N'~'))+LEN('Status~'),1) As ModifiedStatus,
AuditHistory.ChangeDate,AuditHistory.Operation,AuditHistory.UserID 
FROM 
PMTask INNER JOIN AuditHistory ON PMTask.CompanyID=AuditHistory.CompanyID AND AuditHistory.TableName='PMTask' AND CAST(PMTask.ProjectID as varchar)+CHAR(0)+PMTask.TaskCD=AuditHistory.CombinedKey
WHERE REPLACE(ModifiedFields, NCHAR(0) COLLATE Latin1_General_100_BIN2, N'~') LIKE '%Status~%'

IMPORTANT: I believe that you’re a MYOB Acumatica user, and they run on MySql -- the query above would need to be adapted to your database by a developer. ChatGPT seems to be able to convert it just fine, but i’m not sure if this accurately deals with the way MySql would have the null character.

Here’s sample output of this query from my test database:

 

Schema fields could be set in the generic inquiry to convert the status codes to their proper string litteral like ‘Active’, ‘Completed’

 

  1. If you have someone in house that can customize Acumatica, it may be better to store this in a “clean” table that has the list of changes in a format that can be easily reported on. We’ve done this for a CRM Project before where the customer needed to track opportunity stage history.

 

 


Gabriel Michaud
Captain II
Forum|alt.badge.img+11

@Caleb Harriott I worked on this on my flight back, and I adapted the solution to work with MySql. WIth the view and data access class you can create a generic inquiry, and easily pull this generic inquiry into Excel with Velixo if you want to analyze the data in Excel.

 

 

The SQL view adapted for MySql looks like this:

CREATE OR REPLACE VIEW ProjectStatusAuditHistoryView AS
SELECT 
    AuditHistory.CompanyID, 
    AuditHistory.batchID, 
    PMTask.ProjectID, 
    PMTask.TaskCD,
    SUBSTRING_INDEX(
        SUBSTRING_INDEX(
            REPLACE(ModifiedFields, CHAR(0), '~'), 
            'Status~', -1
        ), 
        '~', 1
    ) AS ModifiedStatus,
    AuditHistory.ChangeDate,
    AuditHistory.Operation,
    AuditHistory.UserID 
FROM 
    PMTask 
INNER JOIN 
    AuditHistory 
    ON PMTask.CompanyID = AuditHistory.CompanyID 
    AND AuditHistory.TableName = 'PMTask' 
    AND CONCAT(PMTask.ProjectID, CHAR(0), PMTask.TaskCD) = AuditHistory.CombinedKey
WHERE 
    REPLACE(ModifiedFields, CHAR(0), '~') LIKE '%Status~%';
GO

The customization project is attached to this message.

 

P.S. i’m using the standard PMProject.Status field, I recall from our discussion that you have a custom status field so the database view would need to be adapted to use this field instead, but otherwise the solution is workable...


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings