7ae7cfe8 by Ean Schuessler

Fix PartyMessages docs and add missing required param detection

- Updated PartyMessages wiki docs to emphasize partyId is required
- Added missingRequired and error fields to compact format when
  required parameters are missing
- This helps LLMs understand why a screen shows no forms/grids
1 parent 5dbeedb0
...@@ -536,24 +536,35 @@ This screen manages: Party, Person/Organization, PartyRole, PartyClassification, ...@@ -536,24 +536,35 @@ This screen manages: Party, Person/Organization, PartyRole, PartyClassification,
536 536
537 Send and view messages to/from parties. Use for internal communications about orders, products, or customers. 537 Send and view messages to/from parties. Use for internal communications about orders, products, or customers.
538 538
539 ## Required Parameter
540
541 **partyId** is required to view this screen. Always pass a party ID:
542 ```
543 path: PopCommerce/PopCommerceAdmin/Party/PartyMessages/FindMessage
544 parameters: {partyId: "JohnSales"}
545 ```
546
539 ## Send a Message 547 ## Send a Message
540 548
541 ``` 549 ```
542 action: createMessage 550 action: createMessage
543 parameters: { 551 parameters: {
552 partyId: "JohnSales",
544 toPartyId: "JohnSales", 553 toPartyId: "JohnSales",
545 subject: "New product available", 554 subject: "New product available",
546 body: "The green variant of DEMO_VAR is now in stock." 555 body: "The green variant of DEMO_VAR is now in stock."
547 } 556 }
548 ``` 557 ```
549 558
550 ## Filter Messages 559 ## View Messages for a Party
551 560
552 Pass `partyId` to see messages for a specific party:
553 ``` 561 ```
562 path: PopCommerce/PopCommerceAdmin/Party/PartyMessages/FindMessage
554 parameters: {partyId: "JohnSales"} 563 parameters: {partyId: "JohnSales"}
555 ``` 564 ```
556 565
566 This shows all messages to or from the specified party.
567
557 ## Message Types 568 ## Message Types
558 569
559 Messages are stored as CommunicationEvent entities with: 570 Messages are stored as CommunicationEvent entities with:
...@@ -564,8 +575,8 @@ Messages are stored as CommunicationEvent entities with: ...@@ -564,8 +575,8 @@ Messages are stored as CommunicationEvent entities with:
564 575
565 ## Difference from User/Messages 576 ## Difference from User/Messages
566 577
567 - **Party/PartyMessages**: Admin screen for messaging any party in the system 578 - **Party/PartyMessages**: Admin screen for messaging any party in the system (requires partyId)
568 - **User/Messages**: User-facing screen for current user's own messages 579 - **User/Messages**: User-facing screen for current user's own messages (no partyId needed)
569 580
570 Use PartyMessages when you need to send messages on behalf of the system or to parties who may not have user accounts.]]></fileData> 581 Use PartyMessages when you need to send messages on behalf of the system or to parties who may not have user accounts.]]></fileData>
571 </moqui.resource.DbResourceFile> 582 </moqui.resource.DbResourceFile>
......
...@@ -906,11 +906,21 @@ def convertToCompactFormat = { semanticState, targetScreenPath -> ...@@ -906,11 +906,21 @@ def convertToCompactFormat = { semanticState, targetScreenPath ->
906 def data = semanticState.data 906 def data = semanticState.data
907 def formMetadata = data?.formMetadata ?: [:] 907 def formMetadata = data?.formMetadata ?: [:]
908 def actions = semanticState.actions ?: [] 908 def actions = semanticState.actions ?: []
909 def params = semanticState.parameters ?: [:]
909 910
910 def result = [ 911 def result = [
911 screen: targetScreenPath?.split('/')?.last() ?: "Screen" 912 screen: targetScreenPath?.split('/')?.last() ?: "Screen"
912 ] 913 ]
913 914
915 // Check for missing required parameters
916 def missingRequired = params.findAll { name, info ->
917 info.required == true && info.value == null
918 }
919 if (missingRequired) {
920 result.missingRequired = missingRequired.keySet().toList()
921 result.error = "Required parameters missing: ${missingRequired.keySet().join(', ')}. Pass these parameters to view the screen."
922 }
923
914 // Build summary 924 // Build summary
915 def formCount = formMetadata.count { k, v -> v.type != "form-list" } 925 def formCount = formMetadata.count { k, v -> v.type != "form-list" }
916 def listCount = formMetadata.count { k, v -> v.type == "form-list" } 926 def listCount = formMetadata.count { k, v -> v.type == "form-list" }
......