-
Notifications
You must be signed in to change notification settings - Fork 430
[Shopify] Add cues for Skipped Records and API Errors on Activities page #10092
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -111,6 +111,27 @@ page 30100 "Shpfy Activities" | |
| ToolTip = 'Specifies the number of order updates that aren''t processed.'; | ||
| DrillDownPageId = "Shpfy Orders"; | ||
| } | ||
| field(SkippedRecords; Rec."Skipped Records") | ||
| { | ||
| ApplicationArea = All; | ||
| DrillDownPageId = "Shpfy Skipped Records"; | ||
| StyleExpr = SkippedRecordsStyleTxt; | ||
| ToolTip = 'Specifies the number of records that were skipped during synchronization.'; | ||
| } | ||
| field(APIErrors; Rec."API Errors") | ||
| { | ||
| ApplicationArea = All; | ||
| StyleExpr = APIErrorsStyleTxt; | ||
| ToolTip = 'Specifies the number of log entries that ended with an API error.'; | ||
|
|
||
| trigger OnDrillDown() | ||
| var | ||
| LogEntry: Record "Shpfy Log Entry"; | ||
| begin | ||
| LogEntry.SetRange("Has Error", true); | ||
| Page.Run(Page::"Shpfy Log Entries", LogEntry); | ||
| end; | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -138,6 +159,20 @@ page 30100 "Shpfy Activities" | |
| } | ||
| } | ||
|
|
||
| trigger OnAfterGetRecord() | ||
| begin | ||
| Rec.CalcFields("Skipped Records", "API Errors"); | ||
| if Rec."Skipped Records" > 0 then | ||
| SkippedRecordsStyleTxt := 'Ambiguous' | ||
| else | ||
| SkippedRecordsStyleTxt := 'Favorable'; | ||
|
|
||
| if Rec."API Errors" > 0 then | ||
| APIErrorsStyleTxt := 'Unfavorable' | ||
| else | ||
| APIErrorsStyleTxt := 'Favorable'; | ||
| end; | ||
|
|
||
| trigger OnOpenPage() | ||
| var | ||
| Shop: Record "Shpfy Shop"; | ||
|
|
@@ -161,4 +196,7 @@ page 30100 "Shpfy Activities" | |
| end; | ||
| end; | ||
|
|
||
| var | ||
| SkippedRecordsStyleTxt: Text; | ||
| APIErrorsStyleTxt: Text; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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 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 |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -85,6 +85,18 @@ table 30100 "Shpfy Cue" | |
| Caption = 'Unmapped Companies'; | ||
| FieldClass = FlowField; | ||
| } | ||
| field(10; "Skipped Records"; Integer) | ||
| { | ||
| CalcFormula = count("Shpfy Skipped Record"); | ||
| Caption = 'Skipped Records'; | ||
| FieldClass = FlowField; | ||
| } | ||
| field(11; "API Errors"; Integer) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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 |
||
| { | ||
| CalcFormula = count("Shpfy Log Entry" where("Has Error" = const(true))); | ||
| Caption = 'API Errors'; | ||
| FieldClass = FlowField; | ||
| } | ||
| } | ||
|
|
||
| keys | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new
StyleExprvalues are assigned from inline text literals ('Ambiguous','Favorable','Unfavorable') inOnAfterGetRecord(). 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