-
Notifications
You must be signed in to change notification settings - Fork 631
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Shopify] Log Skipped Records on export processes (#27539)
This pull request does not have a related issue as it's part of delivery for development agreed directly with @AndreiPanko Fixes #26819 ### Created new structure to log records skipped on export Solution has new structure possible to open by typing "Shopify Skipped Records". On page user can see all the skipped records with reasons and date and time when the record was skipped. User can also open the related record using "Show record" action or clicking the "Description" field value. ### Log cases: Customer: - Customer has empty email - Customer with same email or phone exists Posted Sales Invoice: - Customer does not exist in Shopify - Payment terms do not exist in Shopify - Customer No. is Default Customer No. for Shopify Shop - Customer No. is used in Shopify Customer Template - No lines existing in sales invoice - Invalid Quantity - Empty No. value Product: - Item is blocked/sales blocked (Item Variant) - Item is blocked Shipments: - Related Shopify Order does not exist - No lines in Posted Sales Shipment applicable for fulfillment - No corresponding fulfillment found in Shopify. If the condition met log record is being created. ### Retention policy Retention policy is inserted on extension install. It can be turned on "Retention Policies" page. Fixes [AB#473306](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/473306) --------- Co-authored-by: Piotr Michalak <[email protected]> Co-authored-by: Gediminas Gaubys <[email protected]>
- Loading branch information
1 parent
7ca090c
commit c8b01d7
Showing
17 changed files
with
1,436 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
Apps/W1/Shopify/app/src/Logs/Codeunits/ShpfySkipRecordMgt.Codeunit.al
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
namespace Microsoft.Integration.Shopify; | ||
|
||
/// <summary> | ||
/// Codeunit Shpfy Skip Record (ID 30313). | ||
/// </summary> | ||
codeunit 30313 "Shpfy Skipped Record" | ||
Check failure on line 6 in Apps/W1/Shopify/app/src/Logs/Codeunits/ShpfySkipRecordMgt.Codeunit.al
|
||
{ | ||
Access = Internal; | ||
Permissions = tabledata "Shpfy Skipped Record" = rimd; | ||
|
||
/// <summary> | ||
/// Creates log entry for skipped record. | ||
/// </summary> | ||
/// <param name="ShopifyId">Related Shopify Id of the record.</param> | ||
/// <param name="TableId">Table Id of the record.</param> | ||
/// <param name="RecordId">Record Id of the record.</param> | ||
/// <param name="SkippedReason">Reason for skipping the record.</param> | ||
/// <param name="Shop">Shop record.</param> | ||
internal procedure LogSkippedRecord(ShopifyId: BigInteger; RecordId: RecordID; SkippedReason: Text[250]; Shop: Record "Shpfy Shop") | ||
var | ||
SkippedRecord: Record "Shpfy Skipped Record"; | ||
begin | ||
if Shop."Logging Mode" = Enum::"Shpfy Logging Mode"::Disabled then | ||
exit; | ||
SkippedRecord.Init(); | ||
SkippedRecord.Validate("Shopify Id", ShopifyId); | ||
SkippedRecord.Validate("Table ID", RecordId.TableNo()); | ||
SkippedRecord.Validate("Record ID", RecordId); | ||
SkippedRecord.Validate("Skipped Reason", SkippedReason); | ||
SkippedRecord.Insert(true); | ||
end; | ||
|
||
/// <summary> | ||
/// Creates log entry for skipped recordwith empty Shopify Id. | ||
/// </summary> | ||
/// <param name="RecordId">Record Id of the record.</param> | ||
/// <param name="SkippedReason">Reason for skipping the record.</param> | ||
/// <param name="Shop">Shop record.</param> | ||
internal procedure LogSkippedRecord(RecordId: RecordID; SkippedReason: Text[250]; Shop: Record "Shpfy Shop") | ||
begin | ||
LogSkippedRecord(0, RecordId, SkippedReason, Shop); | ||
end; | ||
|
||
} |
44 changes: 44 additions & 0 deletions
44
Apps/W1/Shopify/app/src/Logs/Codeunits/ShpfySkippedRecord.Codeunit.al
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
namespace Microsoft.Integration.Shopify; | ||
|
||
/// <summary> | ||
/// Codeunit Shpfy Skip Record (ID 30313). | ||
/// </summary> | ||
codeunit 30313 "Shpfy Skipped Record" | ||
Check failure on line 6 in Apps/W1/Shopify/app/src/Logs/Codeunits/ShpfySkippedRecord.Codeunit.al
|
||
{ | ||
Access = Internal; | ||
Permissions = tabledata "Shpfy Skipped Record" = rimd; | ||
|
||
/// <summary> | ||
/// Creates log entry for skipped record. | ||
/// </summary> | ||
/// <param name="ShopifyId">Related Shopify Id of the record.</param> | ||
/// <param name="TableId">Table Id of the record.</param> | ||
/// <param name="RecordId">Record Id of the record.</param> | ||
/// <param name="SkippedReason">Reason for skipping the record.</param> | ||
/// <param name="Shop">Shop record.</param> | ||
internal procedure LogSkippedRecord(ShopifyId: BigInteger; RecordId: RecordID; SkippedReason: Text[250]; Shop: Record "Shpfy Shop") | ||
var | ||
SkippedRecord: Record "Shpfy Skipped Record"; | ||
begin | ||
if Shop."Logging Mode" = Enum::"Shpfy Logging Mode"::Disabled then | ||
exit; | ||
SkippedRecord.Init(); | ||
SkippedRecord.Validate("Shopify Id", ShopifyId); | ||
SkippedRecord.Validate("Table ID", RecordId.TableNo()); | ||
SkippedRecord.Validate("Record ID", RecordId); | ||
SkippedRecord.Validate("Skipped Reason", SkippedReason); | ||
SkippedRecord.Insert(true); | ||
end; | ||
|
||
/// <summary> | ||
/// Creates log entry for skipped recordwith empty Shopify Id. | ||
/// </summary> | ||
/// <param name="RecordId">Record Id of the record.</param> | ||
/// <param name="SkippedReason">Reason for skipping the record.</param> | ||
/// <param name="Shop">Shop record.</param> | ||
internal procedure LogSkippedRecord(RecordId: RecordID; SkippedReason: Text[250]; Shop: Record "Shpfy Shop") | ||
begin | ||
LogSkippedRecord(0, RecordId, SkippedReason, Shop); | ||
end; | ||
|
||
} |
95 changes: 95 additions & 0 deletions
95
Apps/W1/Shopify/app/src/Logs/Pages/ShpfySkippedRecords.Page.al
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
namespace Microsoft.Integration.Shopify; | ||
|
||
/// <summary> | ||
/// Page Shpfy Skipped Records (ID 30166). | ||
/// </summary> | ||
page 30166 "Shpfy Skipped Records" | ||
{ | ||
ApplicationArea = All; | ||
Caption = 'Shopify Skipped Records'; | ||
PageType = List; | ||
SourceTable = "Shpfy Skipped Record"; | ||
UsageCategory = Lists; | ||
Editable = false; | ||
InsertAllowed = false; | ||
SourceTableView = sorting("Entry No.") order(descending); | ||
|
||
layout | ||
{ | ||
area(Content) | ||
{ | ||
repeater(General) | ||
{ | ||
field("Shopify Id"; Rec."Shopify Id") { } | ||
field("Table ID"; Rec."Table ID") { } | ||
field("Table Name"; Rec."Table Name") { } | ||
field(Description; Rec.Description) | ||
{ | ||
trigger OnDrillDown() | ||
begin | ||
Rec.ShowPage(); | ||
end; | ||
} | ||
field("Skipped Reason"; Rec."Skipped Reason") { } | ||
} | ||
} | ||
} | ||
|
||
actions | ||
{ | ||
area(Promoted) | ||
{ | ||
group(Category_Process) | ||
{ | ||
actionref(Show_Promoted; Show) { } | ||
} | ||
|
||
group(Category_Category4) | ||
{ | ||
Caption = 'Log Entries'; | ||
|
||
actionref(Delete7days_Promoted; Delete7days) { } | ||
actionref(Delete0days_Promoted; Delete0days) { } | ||
} | ||
} | ||
area(Processing) | ||
{ | ||
action(Show) | ||
{ | ||
ApplicationArea = All; | ||
Caption = 'Show record'; | ||
Image = View; | ||
ToolTip = 'Show the details of the selected record.'; | ||
|
||
trigger OnAction() | ||
begin | ||
Rec.ShowPage(); | ||
end; | ||
} | ||
action(Delete7days) | ||
{ | ||
ApplicationArea = All; | ||
Caption = 'Delete Entries Older Than 7 Days'; | ||
Image = ClearLog; | ||
ToolTip = 'Clear the list of skipped records that are older than 7 days.'; | ||
|
||
trigger OnAction(); | ||
begin | ||
Rec.DeleteEntries(7); | ||
end; | ||
} | ||
action(Delete0days) | ||
{ | ||
ApplicationArea = All; | ||
Caption = 'Delete All Entries'; | ||
Image = Delete; | ||
ToolTip = 'Clear the list of all skipped records.'; | ||
|
||
trigger OnAction(); | ||
begin | ||
Rec.DeleteEntries(0); | ||
end; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.