MSBA-341 · Lesson 12 of 12 · 18 min
Case study: extending purchase orders
▶ Video coming soon A video version of this lesson is on the way.
The last session of the series put the whole feature on one page. Desmond asked Prudence to present the foundry inspection design to Thandeka, Marisol and Annelise as if it were a design review for a new project, explaining each choice and the alternatives rejected. The point, he said, was not to show the code again but to show that every part used the right tool, that nothing modified Microsoft's code, and that the next service update would not break the feature without someone noticing. This lesson follows that review and adds the questions the reviewers asked.
The requirement
Ferrolux Castings and two other foundries supplied pump housings and impellers to the plants. After a run of castings with porosity defects, Cobalt Ridge's quality team required that castings from listed suppliers be received only when a foundry inspection certificate, identified by heat number, had been recorded, or when a quality engineer had approved a waiver. Buyers needed to see the status on purchase lines, warehouse clerks needed to know why a receipt was blocked, quality needed a weekly list of open lines, and auditors needed to see who could do what. The feature had to work in all three companies and in English, French and Spanish.
The design by layer
| Layer | Element | Technique | Lesson |
|---|---|---|---|
| Data | CRInspectionRequired, CRHeatNumber, CRInspectionStatus on PurchLine | Table extension with prefixed EDTs and a new enum | 2 |
| Data | CRInspectionCertTable with CRInspCertId | New table and EDT in CobaltRidgeCustom | 2, 6 |
| Data | Fields in purchase order lines entity | Data entity extension | 2 |
| User interface | Inspection group and heat column on PurchTable form | Form extension and data source wrapper | 2, 3 |
| Logic | Heat number required when inspection is required | CoC on PurchLine.validateWrite | 3 |
| Logic | Receipt blocked until Received or Waived | Thin CoC wrapper on the receipt posting check calling a rule class | 3, 11 |
| Logic | Alert queued when a line is created without a heat number | Data event handler onInserted writing to a queue | 4 |
| Logic | Certificate rules by category | Extensible enum and SysExtension factory | 5 |
| Integration | Certificate recorded business event; Copilot status action | Business event class; client plugin | 5 |
| Process | Certificate numbers INS-CRCA-###### | Reference added to purchase module; numRef on PurchParameters | 6 |
| Process | Waiver approval with value threshold | Workflow type CRInspWaiver with document class | 7 |
| Process | Alert sending, cleanup, weekly report job | SysOperation services in batch | 8 |
| Output | Weekly casting report; heat number on receipts | RDP report; data provider extension and registered design | 9 |
| Access | View, maintain, request, approve, monitor | Privileges, duties, role extension, new role, segregation rule | 10 |
Choices and alternatives
Thandeka asked why the receipt block was a wrapper rather than an event handler. Prudence explained that the check had to change the method's return value so posting would stop, and that a post-event handler could do that through the arguments object but less clearly, while Chain of Command expressed it directly and could use protected members of the posting class if needed. She added that the wrapper was one line calling CRInspectionReceiptRule, which held the logic and had its own tests, so if Microsoft restructured posting, only that line would move.
Marisol asked why the alert was not sent immediately. Prudence explained that the data event ran inside the insert transaction, so sending email there would make every purchase line insert slower and could roll back a valid purchase order if the email server failed. Writing to a queue in the same transaction was cheap and safe, and the batch job sent alerts every fifteen minutes in small transactions. The buyers had agreed that a fifteen-minute delay was acceptable.
Annelise asked why the waiver was a workflow rather than a simple approve button for quality engineers. Desmond answered that the requirement included routing by value, a second approver above the threshold, delegation when an engineer was away, and a full history for audit. A button could do the first step, but all the rest would have been custom code. The workflow framework gave those features for the cost of a workflow type, and functional consultants could adjust thresholds without a developer.
The reviewers also asked about things the design did not do. There was no XDS policy on certificates because engineers covered for other plants. There was no new number sequence module, because one reference in the purchase module put the setup where administrators expected it. There was no overlayering anywhere, and the only copied artifact was the receipt report design, which was registered in print management so it could be switched back.
Release and deployment
The feature was delivered as a deployable package built by the Azure DevOps pipeline from the CobaltRidgeCustom model. The release notes listed the new and changed tables, including the new index on PurchLine and the new certificate table, so Annelise could plan the database synchronization time in the maintenance window. They also listed the new security objects, the number sequence reference that needed a code in each company, the workflow configuration to create, the batch jobs to schedule, and the print management setting for the receipt design. Each of those was a setup step after deployment, and Annelise used a checklist so none was missed in any company.
| Post-deployment step | Owner | Per company |
|---|---|---|
| Run the number sequence generation and assign CRCA_INSP, CRUS_INSP, CRMX_INSP | Annelise | Yes |
| Configure the waiver workflow with the value threshold in local currency | Annelise and Marisol | Yes |
| Schedule the alert, cleanup and weekly report batch jobs | Annelise | Yes |
| Set the receipt report format in print management | Annelise | Yes |
| Assign the CR Quality engineer role and check segregation conflicts | Thandeka's security administrator | Roles may be limited by organization |
| Turn on CRInspectionRequired on purchase lines for listed foundries | Marisol and buyers | Through the purchase lines entity in Excel |
Testing the whole feature
Prudence's test plan had three levels. Unit tests in SysTest covered the inspection rule for each category, the certificate number reference, the RDP row counts and the alert service's handling of failures. Business process tests recorded with Task recorder covered the end-to-end flows: create a casting line without a heat number and see the alert; receive without a certificate and see the block; record a certificate and receive successfully; request a waiver, approve it in two steps and receive. User acceptance testing by Marisol's buyers and the receiving clerks at the plants covered the words on screen, the French labels used by French-speaking staff, and whether the messages explained what to do next.
The French labels produced the only defect found in acceptance testing. The blocked-receipt message read correctly in English but the French translation used a term the French-speaking clerks did not recognize for a heat number. Prudence changed the label in the CRCustom label file, rebuilt the package, and the fix was in the next deployment. Desmond pointed out that this was exactly why labels were never hard-coded: the fix touched one line in one file.
Mapping the case to the exam
The MB-500 skills outline groups the exam into planning architecture and solution design, applying developer tools, designing and developing AOT elements, developing and testing code, implementing reporting, integrating and managing data solutions, and implementing security and optimizing performance. The case touched every area. The extension model and the decision of what to customize were architecture and design. Visual Studio, models, packages and pipelines were developer tools. Tables, EDTs, enums, forms, queries and entities were AOT elements. Chain of Command, event handlers, SysExtension, SysOperation and tests were code. The RDP report and print management were reporting. The data entity and business event were data solutions. Privileges, duties, roles and the thought about transaction sizes and indexes were security and performance. Number sequences and workflow are not named as headings in the current outline, but they come up in projects so often that every finance and operations developer needs them.
What Prudence would do differently
Desmond ended each project review by asking what the team would change. Prudence had three answers. She would write the tests for the receipt block before the wrapper, because the wrapper's first version compiled but was attached to a method that was not on the posting path for one receipt type, and only a later test caught it. She would ask the French-speaking clerks for terminology before writing French labels. And she would file the extensibility request for a delegate on day one rather than after the design was built, because Microsoft's answer takes at least one service update and the cleaner design could have been ready sooner.
Performance review
Before go-live, Desmond held a short performance review of the feature. The new index on PurchLine was used by the heat number lookup and the weekly report, and it added a small cost to every purchase line insert and update, which the team measured in the sandbox as negligible. The data event handler was on PurchLine, a high-volume table, so they checked that no standard batch process used set-based updates on purchase lines in a way that the handler would slow down. The alert queue kept the insert transaction short. The report's query used indexed fields. The review took an hour and was written up in the release notes.
Monitoring after go-live
The feature's first weeks in production were planned to be watched closely. The plan was for Annelise to check the alert batch job history daily, for Marisol to review the number of blocked receipts and waivers each week, and for Desmond to look at the telemetry for errors in the CR classes. Two signals would show whether the feature was working: receipts of castings without a certificate should fall to zero except for approved waivers, and the number of waivers should stay small. A rising waiver count would mean either that foundries were not sending certificates or that the waiver had become a habit, and both were conversations for quality, not code changes.
Handover
The implementation partner would leave after go-live, and Prudence would move on to another project, so the feature had to be maintainable by Cobalt Ridge's own team with Desmond as the lead. The handover package included the design document from this review, the extension inventory from lesson 11, the extension points page from lesson 5, the test scripts, the release notes and the list of setup steps per company. Desmond asked for one more thing: a short recording of Prudence walking through the code in Visual Studio, because seeing where each piece lived was faster than reading about it.
Closing the series
At the end of the review, Thandeka approved the design and signed off the security evidence, and Marisol confirmed that the waiver thresholds and the weekly report met her needs. Desmond told Prudence that the next series would move from extending the application to connecting it to other systems: data entities, OData, integration patterns and business events in depth, which is the subject of MSBA-342. The inspection feature would come back there, because the plant quality system wanted to receive the certificate business event instead of reading the weekly report.
Worked problem
A new requirement
Suppose that three months after go-live Marisol asks that castings from one foundry also require a pressure-test report in addition to the certificate. How should the team extend the feature without reopening the whole design?
Show solution
- Add a value PressureTested to the extensible CRInspectionCategory enum, or reuse an existing category if one fits.
- Create a new rule class extending CRInspectionRule, decorated with the attribute for the new category, that requires both a certificate and a pressure-test document.
- The SysExtension factory selects the new rule for lines in that category; the receipt wrapper and the alert job do not change.
- Add unit tests for the new rule and a regression test for one receipt in the category.
Answer: Because the rule was designed for change in lesson 5, the new requirement is one enum value and one class, with no changes to wrappers, handlers or workflows.
Common mistakes
MistakePresenting a design review as a code walkthrough.
InsteadExplain each choice, the alternatives rejected and how the design survives updates.
MistakeLeaving post-deployment setup to memory.
InsteadList number sequences, workflows, batch jobs, print management and roles in the release notes and a checklist.
MistakeTesting only in English.
InsteadTest labels and messages in every language users work in.
MistakeWriting tests after the code is finished.
InsteadWrite the test that proves a rule is enforced before writing the wrapper.
Summary and key terms
- The inspection feature used table, form, entity and EDT extensions, a new table and enum, Chain of Command, event handlers and SysExtension.
- It added a number sequence reference, a workflow type, SysOperation batch jobs, an RDP report and a data provider extension.
- Security used custom privileges and duties, a role extension, a new role and a segregation of duties rule.
- Release notes and a per-company checklist covered setup after deployment.
- Thin wrappers, rule classes and automated tests kept the feature safe through service updates.
- Design review
- A meeting where a solution is explained with its choices and alternatives before or after build.
- Post-deployment setup
- Configuration that must be done after a package is deployed, such as number sequences and batch jobs.
- Rule class
- A custom class that holds business logic so wrappers can stay thin.
- Acceptance testing
- Testing by business users to confirm the feature meets their needs.
- Release notes
- A document listing what a package changes and what setup it needs.
Practice problems
Work each problem on paper first, then reveal the answer to check.
Why did the alert use a queue and a batch job?
Show answer
Sending email inside the insert transaction would slow inserts and could roll back valid purchase orders.
Which part of the design made the pressure-test requirement easy?
Show answer
The extensible category enum and the SysExtension rule factory from lesson 5.
Which setup steps must be repeated in each company?
Show answer
Number sequence codes, workflow configuration, batch jobs and print management settings.
Lesson quiz · 5 questions
Score 60% or more to complete this lesson.
Create a free account to save your progress, take quizzes and earn a certificate.