We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Exclude Internal Labor Time Cards from Expense Lines + Cleanup of Historical Data

dennisreuko
Tera Contributor

Hi everyone,

 

I’m working on a requirement specifically for pm_project records, where internal labor time cards should not appear in expense lines or affect project financials.

 

Acceptance criteria:

No internal labor time card entries should impact:

 

  • Actual Cost

  • Estimate at Completion (EAC)

  • Estimate to Completion (ETC)

 

 

What I’ve done so far (for new records):

Implemented a solution to prevent new expense lines from being created from time cards.

Business Rule:

  • Table: Expense Line [fm_expense_line]
  • When: before insert

  • Order: 1

  • No OOB records modified (upgrade safe)

Logic:

  • If time_card is populated, OR
  • If short_description contains " Time Card ("

    → abort insert (gs.setAbortAction(true))

This is working as expected - no new time card expense lines are being created for pm_project records.

 

Where I’m stuck (historical data):

There are many existing expense lines already created from time cards, and I need to clean those up for pm_project financials.

Issues:

  • Many records don’t have the time_card reference populated
  • Sometimes the only indicator is the description (e.g., “Time Card (…)”)

  • Some descriptions are truncated (e.g., "Time Car", "Time C", "Time", "Tim")

  • category = Labor is not reliable since it includes valid external labor

So it’s hard to safely identify only time card–generated expense lines without risking valid data.

 

What I’m trying to solve:

  • Remove or exclude only internal labor time card expense lines tied to pm_project
  • Keep the solution safe and reversible

  • Stay as close to OOB behavior as possible

 

Questions:

  1. Has anyone handled cleanup of legacy time card expense lines specifically for pm_project financials?
  2. Is there a reliable way to trace these back to time cards when the time_card field is empty?

  3. Would you recommend?

Appreciate any suggestions, thanks!

 

0 REPLIES 0