-
Notifications
You must be signed in to change notification settings - Fork 340
bugs/618894 - [Quality Management] Add API pages and external business events for Power Automate #6852
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
Open
alexei-dobriansky
wants to merge
25
commits into
main
Choose a base branch
from
Issue6226
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
bugs/618894 - [Quality Management] Add API pages and external business events for Power Automate #6852
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 64a5d92
FIx publisher and sorting order
aldobriansky 0a9be22
Merge branch 'main' of https://github.com/microsoft/BCApps into Issue…
aldobriansky 60121f6
Fix boolean parsing
aldobriansky 1f9434a
Merge branch 'main' of https://github.com/microsoft/BCApps into Issue…
aldobriansky d7b7bdf
Address comments for API pages
aldobriansky 194f34a
Merge branch 'main' of https://github.com/microsoft/BCApps into Issue…
aldobriansky ff5cc3d
Merge branch 'main' of https://github.com/microsoft/BCApps into Issue…
aldobriansky cd71baa
Merge branch 'main' of https://github.com/microsoft/BCApps into Issue…
aldobriansky a8c95c1
Test API
aldobriansky 37df68a
Merge branch 'main' of https://github.com/microsoft/BCApps into Issue…
aldobriansky 75fb018
Merge branch 'main' of https://github.com/microsoft/BCApps into Issue…
aldobriansky 3d12581
Remove excessive API category, remove comments
aldobriansky 4238e42
Fix API pages properties
aldobriansky 1510200
Merge branch 'main' of https://github.com/microsoft/BCApps into Issue…
aldobriansky 297ee3d
Merge branch 'main' of https://github.com/microsoft/BCApps into Issue…
aldobriansky 4a9b7f2
Merge branch 'main' of https://github.com/microsoft/BCApps into Issue…
aldobriansky a488b9a
Apply PR suggestions
aldobriansky 46e0812
Merge branch 'main' of https://github.com/microsoft/BCApps into Issue…
aldobriansky 3c9a106
Merge branch 'main' of https://github.com/microsoft/BCApps into Issue…
aldobriansky 444b290
Fix warning
aldobriansky 235ae9f
Merge branch 'main' of https://github.com/microsoft/BCApps into Issue…
aldobriansky e2962b2
Revert Query renaming
aldobriansky e2ee5b6
Merge branch 'main' of https://github.com/microsoft/BCApps into Issue…
aldobriansky 64dac0d
Disable API tests until authentication issue is resolved
aldobriansky File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
144 changes: 144 additions & 0 deletions
144
src/Apps/W1/Quality Management/app/src/API/QltyCreateInspectionAPI.Page.al
This file contains hidden or 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,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; | ||
| } | ||
18 changes: 18 additions & 0 deletions
18
src/Apps/W1/Quality Management/app/src/API/QltyEventCategory.EnumExt.al
This file contains hidden or 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,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'; | ||
| } | ||
| } |
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.