{"title":"Codeunit 4417 SOA Item Selector, extension points 29","url":"https://jonas-paprotka.de/ref/codeunit/4417-soa-item-selector/points/","author":"JOP-AL","license":"Metadata from Microsoft's symbol packages. AL source MIT, Copyright (c) Microsoft Corporation. Selection and wording © 2026 JOP-AL. https://jonas-paprotka.de/licenses/","subject":"Microsoft Dynamics 365 Business Central","checked":"2026-11-20","changed":"2026-10-05","object":{"type":"codeunit","id":4417,"name":"SOA Item Selector","app":"Sales Order Agent","url":"https://jonas-paprotka.de/ref/codeunit/4417-soa-item-selector/"},"major":29,"source":{"url":"https://jonas-paprotka.de/ref/codeunit/4417-soa-item-selector/source/","path":"src/Apps/W1/SalesOrderAgent/app/src/ItemSearch/SOAItemSelector.Codeunit.al","commit":"4303e5e584d3aa5d9e98cbc615525a5396ad6ed7","lines":"a line is <source url>#L<line>"},"steps":{"event":"[line, \"event\", name, handled]: raises an event of this object; handled 1 when it has an IsHandled parameter","call":"[line, \"call\", name, arguments]: calls a procedure of this object","ext":"[line, \"ext\", type, id, name, arguments]: calls a procedure of another object, through a variable declared with that type","write":"[line, \"write\", table id, method, 1 when called with true]: Insert, Modify, ModifyAll, Delete, DeleteAll or Rename","validate":"[line, \"validate\", table id, field name]","run":"[line, \"run\", type, id]: Codeunit.Run, Page.Run, Report.Run and their kin"},"objects":{"codeunit:7771":{"name":"Azure OpenAI","url":"https://jonas-paprotka.de/ref/codeunit/7771-azure-openai/"},"codeunit:7768":{"name":"AOAI Deployments","url":"https://jonas-paprotka.de/ref/codeunit/7768-aoai-deployments/"},"codeunit:7761":{"name":"AOAI Chat Completion Params","url":"https://jonas-paprotka.de/ref/codeunit/7761-aoai-chat-completion-params/"},"codeunit:7763":{"name":"AOAI Chat Messages","url":"https://jonas-paprotka.de/ref/codeunit/7763-aoai-chat-messages/"},"codeunit:7770":{"name":"AOAI Operation Response","url":"https://jonas-paprotka.de/ref/codeunit/7770-aoai-operation-response/"},"codeunit:4416":{"name":"SOA Item Selector Func","url":"https://jonas-paprotka.de/ref/codeunit/4416-soa-item-selector-func/"},"codeunit:7758":{"name":"AOAI Function Response","url":"https://jonas-paprotka.de/ref/codeunit/7758-aoai-function-response/"},"codeunit:8703":{"name":"Feature Telemetry","url":"https://jonas-paprotka.de/ref/codeunit/8703-feature-telemetry/"},"codeunit:4400":{"name":"SOA Setup","url":"https://jonas-paprotka.de/ref/codeunit/4400-soa-setup/"},"codeunit:4598":{"name":"SOA Instructions","url":"https://jonas-paprotka.de/ref/codeunit/4598-soa-instructions/"}},"procs":[{"name":"SelectBestMatchingItems","line":39,"kind":"procedure","access":"internal","params":7,"steps":[[51,"call","TrySelectBestMatchingItems",9],[53,"call","LogItemSelectorException",2],[58,"call","LogItemSelectorResponseFailure",3]]},{"name":"TrySelectBestMatchingItems","line":67,"kind":"procedure","access":"local","params":9,"steps":[[80,"call","GetItemSelectorSystemPrompt",1],[86,"ext","codeunit",7771,"SetAuthorization",2],[86,"ext","codeunit",7768,"GetGPT56CeresLatest",0],[87,"ext","codeunit",7771,"SetCopilotCapability",1],[90,"ext","codeunit",7761,"SetMaxTokens",1],[90,"call","MaxTokens",0],[91,"ext","codeunit",7761,"SetTemperature",1],[94,"ext","codeunit",7763,"AddTool",1],[95,"ext","codeunit",7763,"SetPrimarySystemMessage",1],[96,"ext","codeunit",7763,"AddUserMessage",1],[96,"call","BuildUserMessage",3],[99,"ext","codeunit",7771,"GenerateChatCompletion",3],[101,"ext","codeunit",7770,"IsSuccess",0],[103,"ext","codeunit",7770,"GetStatusCode",0],[107,"ext","codeunit",7770,"IsFunctionCall",0],[113,"ext","codeunit",7770,"GetFunctionResponses",0],[114,"ext","codeunit",4416,"Execute",1],[114,"ext","codeunit",7758,"GetArguments",0],[115,"ext","codeunit",4416,"IsSelectionResultValid",0],[116,"ext","codeunit",4416,"GetSelectionResultFailureCategory",0],[120,"ext","codeunit",4416,"GetSelectionResult",4]]},{"name":"LogItemSelectorException","line":129,"kind":"procedure","access":"local","params":2,"steps":[[136,"ext","codeunit",8703,"LogError",6],[136,"ext","codeunit",4400,"GetFeatureName",0]]},{"name":"LogItemSelectorResponseFailure","line":139,"kind":"procedure","access":"local","params":3,"steps":[[149,"ext","codeunit",8703,"LogError",6],[149,"ext","codeunit",4400,"GetFeatureName",0]]},{"name":"GetItemSelectorSystemPrompt","line":153,"kind":"procedure","access":"local","params":1,"steps":[[157,"ext","codeunit",4598,"GetItemSelectorSystemPrompt",1]]},{"name":"BuildUserMessage","line":160,"kind":"procedure","access":"local","params":3,"steps":[[170,"call","SanitizeUntrustedText",1],[171,"call","SanitizeUntrustedText",1],[178,"call","SanitizeUntrustedText",1]]},{"name":"SanitizeUntrustedText","line":182,"kind":"procedure","access":"local","params":1,"steps":[[194,"call","ReplaceCaseInsensitive",3],[195,"call","ReplaceCaseInsensitive",3],[196,"call","ReplaceCaseInsensitive",3],[197,"call","ReplaceCaseInsensitive",3],[198,"call","ReplaceCaseInsensitive",3],[199,"call","ReplaceCaseInsensitive",3],[200,"call","ReplaceCaseInsensitive",3],[201,"call","ReplaceCaseInsensitive",3],[202,"call","ReplaceCaseInsensitive",3],[203,"call","ReplaceCaseInsensitive",3],[204,"call","ReplaceCaseInsensitive",3],[205,"call","ReplaceCaseInsensitive",3],[206,"call","ReplaceCaseInsensitive",3],[207,"call","ReplaceCaseInsensitive",3]]}]}