Back to Resources

SPM Enhancements (Gabe, 2026-09-29) - hand-off to the codeunit / AL agent

Blog

SPM Enhancements - items for the codeunit / AL agent

Source: e-mail "FW: SPM Enhancements" (Gabe Cugelman -> Erik, 2026-09-29). The portal agent (APD templates + script actions) does the UI items. This document lists the parts that need compiled AL (codeunit-type actions, table triggers, e-mail sending).

Context: what the portal side writes

  • Work Card = page PMC.TASK (Job Task 1001, keyed by 1001:1 + 1001:2).
  • Work-card status change + assignment is posted by PMC.TASK.ASSIGN -> TASK.ASSIGN.EXE (codeunit-type action, NOT a script). Fields posted: 1001:1, 1001:2, 73001:6 (new status code from Job Task Status 73002), 73001:4 (resource no.), hours, Comment, _internal.
  • Project-level ("PMC") task fields: Job Task."PMC Task Status" (59128, 0 Not started / 1 In progress / 2 At risk / 3 Completed), "PMC Percent Complete" (59127), "Assigned To" (73005).
  • Resource assignments: table PMC Assigned Resource (59133) PK Job+Task+Resource, Primary Assignment (7). PMC.MY.TASKS is driven by this table, not by "Assigned To".
  • Reference implementation of "assign + make primary + mirror Assigned To": script action PMC.ASSIGN.ADD.EXE (clear Primary on other rows, insert/modify row, set JobTask."Assigned To").
  • Ticket <-> task link: Job Task.FromSupportTicket (73017), FromSupportTicketId (73018, Guid) and Support Question.RegardingJob (13) / RegardingTask (14). Set by script SUPPORT.TASK.ADD.EXE.

CRITICAL

C1. Work-card assignment must update the project-task assignment

In TASK.ASSIGN.EXE, when 73001:4 (resource) is non-blank:

  1. Upsert PMC Assigned Resource (Job, Task, Resource) with Resource Name.
  2. Set Primary Assignment := true on that row, false on all other rows of the same task.
  3. Job Task."Assigned To" := resource.

(Exactly the logic of PMC.ASSIGN.ADD.EXE with primary=1.)

C2. Work-card status must drive project-task status

In TASK.ASSIGN.EXE (and anywhere else ICA Status 73000 is changed, e.g. TASK.UPDATE.EXE, TASK.CLOSE, TASK.UPLOAD.EXE):

  • Any status change: if PMC Task Status = 0 (Not started) -> 1 (In progress).
  • New status = the "finished" code (today FINISHED; see C4) -> PMC Task Status := 3, PMC Percent Complete := 100.
  • Consider putting this in an OnValidate/OnModify of field 73000 on Job Task (table extension) so every entry point is covered, instead of in each action.
  • Optional (ask Gabe/Erik): when finished and FromSupportTicket = true, set the linked Support Question.Status := Answered (or a new Closed value) and post a closing note to the ticket.

C3. Task created from a ticket = customer communication on the task

  • SUPPORT.TASK.ADD.EXE (portal script) will be changed by the portal agent to also set Job Task."Customer No." (73001) from Support Question."Customer No.".
  • AL side needed: a history/comment on the work card that is NOT internal (Job Task History.InternalComment = false) must be e-mailed to the ticket creator (Support Question.Email + CC) and ideally also be appended to the ticket thread, so the customer can reply. Conversely, a customer reply on the ticket should appear on the work card (or at least notify the primary resource). Define which side is the master thread.

C4. Standardise "completed" statuses (decision needed)

Today: Support Question.Status Answered; Job Task Status codes FINISHED/DONE/CLOSED (73002); PMC Task Status Completed. Proposal: one "Closed" meaning per layer, with a mapping table (Job Task Status. "Completes task" boolean) so C2 does not hard-code a code. Needs a data change in 73002 + option value on 73029 -> AL agent.

C5. Ticket assignee gets notifications

Support Question.AssignedResource (12) is set by SUPPORT.ASSIGN.EXE (script) but nothing reads it. In the reply/notification code (SUPPORT.NEW.REPLY, SUPPORT.UPLOAD.QUESTION, codeunit-type): when the poster is the customer, send the notification to the assigned resource's e-mail (Resource -> APD User / Employee e-mail) in addition to/instead of the generic support mailbox.

HIGH PRIORITY

H1. Wrong sender on customer follow-up mails

Notification for a customer reply ("The following update is posted by User ...") is sent From: Accounting@efoqus.ca To: support@efoqus.ca. That is the default e-mail account/scenario in BC. Fix in the codeunit behind SUPPORT.NEW.REPLY (use an explicit e-mail account / scenario "Support", From = support@efoqus.ca, Reply-To = customer). Also check Email Scenario assignment in BC.

H2. Completed projects disappear from SPM

PMC.PROJECTS only filters Job."Hide from SPM" = false - it does NOT filter on Status. So something on the BC side sets Hide from SPM (73003) when Status becomes Completed (Job OnModify/OnValidate Status, or a job queue). Please find and remove/limit it. The portal agent will add a "Show completed" toggle and read-only treatment for Status = Completed.

Portal-side items (FYI, handled by the portal agent)

Latest Support Tickets widget (shows 1 ticket + completed), Support Admin default = Open, task link on Support Admin rows, E-Task No. + link in project grid, My Tasks in user drop-down, My Tasks default open + Closed filter, All Tasks admin view, resource add via Save, Customer No. on task created from ticket, show-completed projects toggle.

Stay ahead of the curve

Let's discuss how Business Central can solve your specific challenges.

Talk to an Expert