mirror of
https://github.com/microsoft/BCQuality.git
synced 2026-10-06 15:16:56 +01:00
Three Microsoft-layer articles with good/bad samples: - error-handling/declined-confirm-must-abort-not-partially-apply - data-modeling/delete-master-data-with-trigger - data-modeling/master-data-must-be-inserted-with-trigger Wire targeted worklist cues into al-error-handling-review and al-data-modeling-review and register the samples in review-fixtures.json. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
46 lines
1.4 KiB
AL
46 lines
1.4 KiB
AL
table 50100 "Sample Mailbox Watch"
|
|
{
|
|
fields
|
|
{
|
|
field(1; "Code"; Code[20])
|
|
{
|
|
}
|
|
field(2; "Watched Email"; Text[250])
|
|
{
|
|
trigger OnValidate()
|
|
var
|
|
StopWatchingQst: Label 'Email %1 is being watched. Stop watching it?', Comment = '%1 = previous email address';
|
|
begin
|
|
if (xRec."Watched Email" <> '') and (xRec."Watched Email" <> "Watched Email") then
|
|
if Confirm(StopWatchingQst, false, xRec."Watched Email") then
|
|
Unsubscribe("Subscription ID");
|
|
// On "no" the old subscription is never removed, and the only field
|
|
// that tracked it is overwritten here: it is orphaned.
|
|
"Subscription ID" := Subscribe("Watched Email");
|
|
end;
|
|
}
|
|
field(3; "Subscription ID"; Guid)
|
|
{
|
|
Editable = false;
|
|
}
|
|
}
|
|
|
|
keys
|
|
{
|
|
key(PK; "Code")
|
|
{
|
|
Clustered = true;
|
|
}
|
|
}
|
|
|
|
local procedure Subscribe(EmailAddress: Text[250]): Guid
|
|
begin
|
|
// Registers EmailAddress with the external watch service and returns its subscription.
|
|
exit(CreateGuid());
|
|
end;
|
|
|
|
local procedure Unsubscribe(SubscriptionId: Guid)
|
|
begin
|
|
// Removes the subscription from the external watch service.
|
|
end;
|
|
}
|