[Shopify] Add cues for Skipped Records and API Errors on Activities page - #10092
[Shopify] Add cues for Skipped Records and API Errors on Activities page#10092Onat Buyukakkus (onbuyuka) wants to merge 1 commit into
Conversation
Skipped records from background (Job Queue) syncs and logged API errors were invisible unless users manually opened the logs. Add two cues to the Shpfy Cue table (30100) and Shpfy Activities page (30100): - Skipped Records: count of Shpfy Skipped Record, styled amber when > 0, drills down to the Shpfy Skipped Records page. - API Errors: count of Shpfy Log Entry with Has Error = true, styled red when > 0, drills down to the Shpfy Log Entries page filtered to errors. Both cues are unfiltered by date; the Retention Policy framework (1-month period on SystemCreatedAt) handles cleanup. Fixes AB#646260 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 26d86952-9110-4708-a976-98be9eb2bfe7
c794f35 to
c951d80
Compare
| Caption = 'Skipped Records'; | ||
| FieldClass = FlowField; | ||
| } | ||
| field(11; "API Errors"; Integer) |
There was a problem hiding this comment.
The new "API Errors" FlowField counts "Shpfy Log Entry" rows filtered by "Has Error" = true, but the source table (Shpfy Log Entry, table 30115) only declares Key1 on "Entry No." with no key covering "Has Error" in SumIndexFields. Per CodeCop AA0232 / this article, a FlowField's source table needs a key that covers the CalcFormula's WHERE clause fields for the platform to answer CalcFields from SIFT; without it, every CalcFields call (triggered on each page activation via RefreshOnActivate = true and explicitly in the new OnAfterGetRecord trigger) falls back to a row-by-row scan of the log table, which grows unbounded over time.
Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.31.4
| trigger OnAfterGetRecord() | ||
| begin | ||
| Rec.CalcFields("Skipped Records", "API Errors"); | ||
| if Rec."Skipped Records" > 0 then |
There was a problem hiding this comment.
The new StyleExpr values are assigned from inline text literals ('Ambiguous', 'Favorable', 'Unfavorable') in OnAfterGetRecord(). These style tokens form a small contract with the page runtime, so leaving them as repeated magic strings makes typos and future drift harder to spot. Define named object-scope constants or locked labels for the allowed style values and assign those instead.
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.31.4
|
|
||
| var | ||
| SkippedRecordsStyleTxt: Text; | ||
| APIErrorsStyleTxt: Text; |
There was a problem hiding this comment.
The page file ends without a trailing newline. Add a final newline after the closing brace so the file matches normal source-file formatting conventions and avoids repeated \ No newline at end of file diff noise in future changes.
Suggested fix (apply manually — could not be anchored as a one-click suggestion):
}👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.31.4
|
This change adds two new Shopify cue FlowFields plus page-side styling and drilldown behavior, but no Shopify test codeunit changes accompany it. Add tests that seed skipped-record and error-log data, open "Shpfy Activities", and verify the new cue counts, style states, and the "API Errors" drilldown filter so these UI/data behaviors are covered by regression tests. Line mapping was unavailable, so this was posted as an issue comment. 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.31.4 |
What & why
Skipped records from background (Job Queue) Shopify syncs and logged API errors were invisible unless users manually opened the logs — the skipped-record notification relies on
GuiAllowed, which isfalsein background sessions, and the Job Queue entry still shows Success. This adds two cues to the Shopify Activities page so users see issues at a glance:count("Shpfy Skipped Record"), styled amber when > 0, drills down to the Shpfy Skipped Records page.count("Shpfy Log Entry" where "Has Error" = true), styled red when > 0, drills down to the Shpfy Log Entries page filtered to errors.New FlowFields (10, 11) on the
Shpfy Cuetable (30100) and two cue tiles on theShpfy Activitiespage (30100). Both cues are unfiltered by date; the Retention Policy framework (1-month period onSystemCreatedAt, already registered for both tables) handles cleanup. Follows the existing cue pattern (Unmapped Customers, Unprocessed Orders, Synchronization Errors).Linked work
Fixes AB#646260
How I validated this
What I tested and the outcome
al_build) — packages with no new warnings.CalcFormulaplus page tiles and drill-downs) with no custom AL logic to unit-test; validated manually in BC.Risk & compatibility
Low — additive only: two new FlowFields on an internal cue table plus two cue tiles. No table schema/data changes, no breaking changes. Read permissions already cover the underlying tables (
Shpfy Skipped RecordandShpfy Log EntryareRinShpfy - Read).