Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
bf7e041
Issue6226 untested port of IWXQI external business events and power a…
insightworks007 Feb 9, 2026
64a5d92
FIx publisher and sorting order
aldobriansky Feb 19, 2026
0a9be22
Merge branch 'main' of https://github.com/microsoft/BCApps into Issue…
aldobriansky Feb 19, 2026
60121f6
Fix boolean parsing
aldobriansky Feb 19, 2026
1f9434a
Merge branch 'main' of https://github.com/microsoft/BCApps into Issue…
aldobriansky Feb 20, 2026
d7b7bdf
Address comments for API pages
aldobriansky Feb 20, 2026
194f34a
Merge branch 'main' of https://github.com/microsoft/BCApps into Issue…
aldobriansky Feb 20, 2026
ff5cc3d
Merge branch 'main' of https://github.com/microsoft/BCApps into Issue…
aldobriansky Feb 23, 2026
cd71baa
Merge branch 'main' of https://github.com/microsoft/BCApps into Issue…
aldobriansky Feb 24, 2026
a8c95c1
Test API
aldobriansky Feb 24, 2026
37df68a
Merge branch 'main' of https://github.com/microsoft/BCApps into Issue…
aldobriansky Feb 24, 2026
75fb018
Merge branch 'main' of https://github.com/microsoft/BCApps into Issue…
aldobriansky Feb 25, 2026
3d12581
Remove excessive API category, remove comments
aldobriansky Feb 25, 2026
4238e42
Fix API pages properties
aldobriansky Feb 25, 2026
1510200
Merge branch 'main' of https://github.com/microsoft/BCApps into Issue…
aldobriansky Feb 25, 2026
297ee3d
Merge branch 'main' of https://github.com/microsoft/BCApps into Issue…
aldobriansky Feb 26, 2026
4a9b7f2
Merge branch 'main' of https://github.com/microsoft/BCApps into Issue…
aldobriansky Feb 26, 2026
a488b9a
Apply PR suggestions
aldobriansky Feb 26, 2026
46e0812
Merge branch 'main' of https://github.com/microsoft/BCApps into Issue…
aldobriansky Feb 26, 2026
3c9a106
Merge branch 'main' of https://github.com/microsoft/BCApps into Issue…
aldobriansky Feb 26, 2026
444b290
Fix warning
aldobriansky Feb 26, 2026
235ae9f
Merge branch 'main' of https://github.com/microsoft/BCApps into Issue…
aldobriansky Feb 27, 2026
e2962b2
Revert Query renaming
aldobriansky Feb 27, 2026
e2ee5b6
Merge branch 'main' of https://github.com/microsoft/BCApps into Issue…
aldobriansky Feb 27, 2026
64dac0d
Disable API tests until authentication issue is resolved
aldobriansky Feb 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------
namespace Microsoft.QualityManagement.API;
using Microsoft.QualityManagement.Document;
using Microsoft.QualityManagement.Utilities;
using Microsoft.Utilities;

/// <summary>
/// Power automate friendly web service for quality inspections.
/// This web service is used to help create quality inspections.
/// </summary>
page 20415 "Qlty. Create Inspection API"
{
APIVersion = 'v1.0';
APIGroup = 'qualityManagement';
APIPublisher = 'microsoft';
Editable = false;
EntityName = 'createQualityInspection';
EntitySetName = 'createQualityInspections';
EntityCaption = 'Create Quality Inspection';
EntitySetCaption = 'Create Quality Inspections';
PageType = API;
SourceTable = "Name/Value Buffer";
SourceTableTemporary = true;
ODataKeyFields = SystemId;

layout
{
area(Content)
{
repeater(SourceDocument)
{
ShowCaption = false;

field(systemIDOfAnyRecord; Rec.SystemId)
{
Caption = 'System ID of any record';
ToolTip = 'Specifies the System ID of the record to create an inspection for.';
}
}
}
}

var
SystemRecord: Guid;
CurrentTable: Integer;
NoSystemIDRecordErr: Label 'Business Central cannot find a record for the System ID of %1', Comment = '%1=the system ID that was not found';
OnlyOneRecordForTableAndFilterErr: Label 'Exactly one record must match the filter, but %1 were found for table %2 with filter %3.', Comment = '%1=count, %2=table, %3=filter';

trigger OnFindRecord(Which: Text): Boolean
var
FilterGroupIterator: Integer;
begin
FilterGroupIterator := 4;
repeat
Rec.FilterGroup(FilterGroupIterator);
if Rec.GetFilter(SystemId) <> '' then
SystemRecord := Rec.GetRangeMin(SystemId);
if Rec.GetFilter(ID) <> '' then
CurrentTable := Rec.GetRangeMin(ID);

FilterGroupIterator -= 1;
until (FilterGroupIterator < 0);
Rec.FilterGroup(0);

Rec.ID := CurrentTable;
Rec.SystemId := SystemRecord;
if Rec.Insert(false, true) then;
exit(Rec.Find(Which));
end;

/// <summary>
/// Creates an inspection from a known table.
/// </summary>
/// <param name="tableName">The table ID or table name to create an inspection for.</param>
/// <param name="ActionContext"></param>
[ServiceEnabled]
procedure CreateInspectionFromRecordID(var ActionContext: WebServiceActionContext; tableName: Text)
var
CreatedInspection: Record "Qlty. Inspection Header";
QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
QltyFilterHelpers: Codeunit "Qlty. Filter Helpers";
AnyInputRecord: RecordRef;
begin
Rec.ID := QltyFilterHelpers.IdentifyTableIDFromText(tableName);

AnyInputRecord.Open(Rec.ID);

if not AnyInputRecord.GetBySystemId(Rec.SystemId) then
Error(NoSystemIDRecordErr, Rec.SystemId);

if QltyInspectionCreate.CreateInspection(AnyInputRecord, true) then begin
QltyInspectionCreate.GetCreatedInspection(CreatedInspection);
ActionContext.SetObjectType(ObjectType::Table);
ActionContext.SetObjectId(Database::"Name/Value Buffer");
ActionContext.AddEntityKey(CreatedInspection.FieldNo(SystemId), CreatedInspection.SystemId);
ActionContext.SetResultCode(WebServiceActionResultCode::Created);
if Rec.IsTemporary() then
Rec.DeleteAll();
Rec.SystemId := CreatedInspection.SystemId;
if Rec.Insert(false, true) then;
end else
ActionContext.SetResultCode(WebServiceActionResultCode::None);
end;

/// <summary>
/// Creates an inspection with a table and table filter to identify a record.
/// </summary>
/// <param name="ActionContext">VAR WebServiceActionContext.</param>
/// <param name="tableName">Text. The table ID, or table name, or table caption.</param>
/// <param name="tableNameFilter">The table filter that can identify a specific record.</param>
[ServiceEnabled]
procedure CreateInspectionFromTableIDAndFilter(var ActionContext: WebServiceActionContext; tableName: Text; tableNameFilter: Text)
var
CreatedInspection: Record "Qlty. Inspection Header";
QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
QltyFilterHelpers: Codeunit "Qlty. Filter Helpers";
AnyInputRecord: RecordRef;
begin
Rec.ID := QltyFilterHelpers.IdentifyTableIDFromText(tableName);
AnyInputRecord.Open(Rec.ID);
AnyInputRecord.SetView(tableNameFilter);
if not AnyInputRecord.FindSet(false) then
Error(OnlyOneRecordForTableAndFilterErr, 0, Rec.ID, tableNameFilter);

if AnyInputRecord.Count() <> 1 then
Error(OnlyOneRecordForTableAndFilterErr, AnyInputRecord.Count(), Rec.ID, tableNameFilter);

if QltyInspectionCreate.CreateInspection(AnyInputRecord, true) then begin
QltyInspectionCreate.GetCreatedInspection(CreatedInspection);
ActionContext.SetObjectType(ObjectType::Table);
ActionContext.SetObjectId(Database::"Name/Value Buffer");
ActionContext.AddEntityKey(CreatedInspection.FieldNo(SystemId), CreatedInspection.SystemId);
ActionContext.SetResultCode(WebServiceActionResultCode::Created);
if Rec.IsTemporary() then
Rec.DeleteAll();
Rec.SystemId := CreatedInspection.SystemId;
if Rec.Insert(false, true) then;
end else
ActionContext.SetResultCode(WebServiceActionResultCode::None);
end;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------
namespace Microsoft.QualityManagement.API;

using System.Integration;

/// <summary>
/// Used for external business events, such as power automate integration.
/// </summary>
enumextension 20403 QltyEventCategory extends EventCategory
{
value(20400; QltyEventCategory)
{
Caption = 'Quality Management';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@ using Microsoft.QualityManagement.Document;
/// <summary>
/// Do not use this query outside of web services.
/// Power Automate friendly web service for quality inspections.
/// This web service is used to help list test values.
/// This web service is used to help list inspection values.
/// </summary>
query 20401 "Qlty. Inspection Values"
{
QueryType = API;
Caption = 'Quality Inspection Values', Locked = true;
APIPublisher = 'microsoft';
APIGroup = 'qualityInspection';
APIGroup = 'qualityManagement';
APIVersion = 'v1.0';
EntityName = 'qualityInspectionValue';
EntityCaption = 'Quality Inspection Value';
Expand Down
Loading
Loading