{"title":"Codeunit 4586 SOA Dispatcher, extension points 29","url":"https://jonas-paprotka.de/ref/codeunit/4586-soa-dispatcher/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":4586,"name":"SOA Dispatcher","app":"Sales Order Agent","url":"https://jonas-paprotka.de/ref/codeunit/4586-soa-dispatcher/"},"major":29,"source":{"url":"https://jonas-paprotka.de/ref/codeunit/4586-soa-dispatcher/source/","path":"src/Apps/W1/SalesOrderAgent/app/src/Integration/SOADispatcher.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:4587":{"name":"SOA Impl","url":"https://jonas-paprotka.de/ref/codeunit/4587-soa-impl/"},"codeunit:4400":{"name":"SOA Setup","url":"https://jonas-paprotka.de/ref/codeunit/4400-soa-setup/"},"codeunit:7785":{"name":"Copilot Quota","url":"https://jonas-paprotka.de/ref/codeunit/7785-copilot-quota/"},"codeunit:4582":{"name":"SOA Retrieve Emails","url":"https://jonas-paprotka.de/ref/codeunit/4582-soa-retrieve-emails/"},"codeunit:8703":{"name":"Feature Telemetry","url":"https://jonas-paprotka.de/ref/codeunit/8703-feature-telemetry/"},"codeunit:4581":{"name":"SOA Send Replies","url":"https://jonas-paprotka.de/ref/codeunit/4581-soa-send-replies/"},"codeunit:4396":{"name":"SOA Email Setup","url":"https://jonas-paprotka.de/ref/codeunit/4396-soa-email-setup/"},"codeunit:7771":{"name":"Azure OpenAI","url":"https://jonas-paprotka.de/ref/codeunit/7771-azure-openai/"},"codeunit:4321":{"name":"Agent","url":"https://jonas-paprotka.de/ref/codeunit/4321-agent/"},"table:4325":{"name":"SOA Setup","url":"https://jonas-paprotka.de/ref/table/4325-soa-setup/"},"codeunit:457":{"name":"Environment Information","url":"https://jonas-paprotka.de/ref/codeunit/457-environment-information/"},"codeunit:6300":{"name":"Azure AD Mgt.","url":"https://jonas-paprotka.de/ref/codeunit/6300-azure-ad-mgt/"},"codeunit:9005":{"name":"Url Helper","url":"https://jonas-paprotka.de/ref/codeunit/9005-url-helper/"},"table:4594":{"name":"SOA Task","url":"https://jonas-paprotka.de/ref/table/4594-soa-task/"}},"procs":[{"name":"OnRun","line":35,"kind":"trigger","steps":[[37,"call","RunSOAgent",1]]},{"name":"RunSOAgent","line":40,"kind":"procedure","params":1,"steps":[[54,"ext","codeunit",4587,"RemoveScheduledTasksIfAgentNotActive",1],[57,"ext","codeunit",4400,"CheckSOASetupStillValid",1],[62,"call","CanRunTask",1],[65,"call","AddTask",1],[67,"ext","codeunit",4400,"CheckSOASetupStillValid",1],[70,"ext","codeunit",7785,"CanConsume",0],[74,"run","codeunit",4582],[76,"ext","codeunit",8703,"LogUsage",4],[76,"ext","codeunit",4400,"GetFeatureName",0],[78,"ext","codeunit",8703,"LogError",6],[78,"ext","codeunit",4400,"GetFeatureName",0],[82,"ext","codeunit",4400,"CheckSOASetupStillValid",1],[85,"run","codeunit",4581],[87,"ext","codeunit",8703,"LogUsage",4],[87,"ext","codeunit",4400,"GetFeatureName",0],[89,"ext","codeunit",8703,"LogError",6],[89,"ext","codeunit",4400,"GetFeatureName",0],[94,"ext","codeunit",4400,"CheckSOASetupStillValid",1],[97,"ext","codeunit",4587,"ScheduleSOAgent",1],[102,"call","UpdateLastSync",2],[105,"call","UpdateTaskSucceeded",2],[105,"ext","codeunit",4581,"GetAllSentSuccessfully",0],[108,"ext","codeunit",4396,"RemoveProcessedEmailsOutsideLast24hrs",0],[110,"ext","codeunit",4587,"RemoveTaskLogsOlderThan24hrs",0]]},{"name":"CanRunTask","line":113,"kind":"procedure","access":"local","params":1,"steps":[[121,"ext","codeunit",7771,"IsEnabled",2],[122,"ext","codeunit",8703,"LogError",6],[122,"ext","codeunit",4400,"GetFeatureName",0],[127,"ext","codeunit",4321,"IsActive",1],[128,"ext","codeunit",8703,"LogError",6],[128,"ext","codeunit",4400,"GetFeatureName",0],[133,"ext","codeunit",8703,"LogError",6],[133,"ext","codeunit",4400,"GetFeatureName",0]]},{"name":"UpdateLastSync","line":140,"kind":"procedure","access":"local","params":2,"steps":[[144,"write",4325,"Modify"]]},{"name":"AddTask","line":148,"kind":"procedure","access":"local","params":1,"steps":[[156,"ext","codeunit",457,"IsSaaSInfrastructure",0],[157,"ext","codeunit",6300,"GetAccessTokenAsSecretText",3],[157,"ext","codeunit",9005,"GetGraphUrl",0],[160,"write",4594,"Insert"]]},{"name":"UpdateTaskSucceeded","line":164,"kind":"procedure","access":"local","params":2,"steps":[[168,"write",4594,"Modify"]]}]}