Repository navigation
New Catalog App - Create Work Event With Agent - #23
jaredjaffa wants to merge 1 commit into
Conversation
Added first version of Create work Event With Agent
| @@ -0,0 +1,122 @@ | |||
| { | |||
There was a problem hiding this comment.
PMDSecurityDomainRule (ACTION)
PMD page is missing required securityDomains list. All PMD pages must define at least one security domain (excludes microConclusion and error pages).
Why: Ensures PMD pages have at least one security domain defined (excludes microConclusion and error pages unless strict mode is enabled)
| @@ -0,0 +1,122 @@ | |||
| { | |||
| "id": "calendarWorkEvents", | |||
| "onLoad": "<% | |||
There was a problem hiding this comment.
PMDSectionOrderingRule (ACTION, was ADVICE)
PMD sections are not in the correct order.
Expected: [1. id, 2. endPoints, 3. onLoad, 4. presentation]
Actual: [1. id, 2. onLoad, 3. presentation, 4. endPoints]
Why: Ensures PMD file root-level sections follow consistent ordering for better readability
| "onLoad": "<% | ||
| // The sample calendar is view-only for non-employees. | ||
| me.workerType.descriptor == 'Employee' ? pageVariables.viewOnly = false : pageVariables.viewOnly = true; | ||
| getWorkEvents.data.forEach(e => { e.status = getBPEvents.data.find(bpEvent => {bpEvent.businessProcessTarget.id == e.id}).status ?? 'Approved'}); |
There was a problem hiding this comment.
ScriptDescriptiveParameterRule (ACTION, was ADVICE)
Parameter 'e' in forEach() should be more descriptive. Consider using a more descriptive name, such as 'item' instead. Single-letter parameters make functions that take function parameters harder to read and debug.
Why: Ensures function parameters use descriptive names when functions take function parameters (except 'a', 'b' for sort)
| // The sample calendar is view-only for non-employees. | ||
| me.workerType.descriptor == 'Employee' ? pageVariables.viewOnly = false : pageVariables.viewOnly = true; | ||
| getWorkEvents.data.forEach(e => { e.status = getBPEvents.data.find(bpEvent => {bpEvent.businessProcessTarget.id == e.id}).status ?? 'Approved'}); | ||
| console.info('augmented work event data is ' + json:asJSON(getWorkEvents.data)); |
There was a problem hiding this comment.
ScriptConsoleLogRule (ACTION)
File section 'onLoad' contains console.info statement. Remove debug statements from production code.
Why: Ensures scripts don't contain console statements (production code)
| console.info('augmented work event data is ' + json:asJSON(getWorkEvents.data)); | |
| // console.info('augmented work event data is ' + json:asJSON(getWorkEvents.data)); |
| // The sample calendar is view-only for non-employees. | ||
| me.workerType.descriptor == 'Employee' ? pageVariables.viewOnly = false : pageVariables.viewOnly = true; | ||
| getWorkEvents.data.forEach(e => { e.status = getBPEvents.data.find(bpEvent => {bpEvent.businessProcessTarget.id == e.id}).status ?? 'Approved'}); | ||
| console.info('augmented work event data is ' + json:asJSON(getWorkEvents.data)); |
There was a problem hiding this comment.
ScriptStringConcatRule (ACTION, was ADVICE)
File section 'onLoad' uses string concatenation with + operator: ''augmented work event data is ' + jsonasJSONgetWorkEvents.data'. Consider using PMD template strings with backticks and {{ }} syntax instead (e.g., Hello {{name}}!).
Why: Detects string concatenation with + operator - use PMD templates with backticks and {{ }} instead
Suggested change:
`augmented work event data is {{jsonasJSONgetWorkEvents.data}}`
| "url": "<% //Grab the request ID using the BP Event ID. queryParams.eventId will automatically pull in the BP Event ID if it is in the page's scope | ||
| var query = 'SELECT businessProcessTarget, status FROM ' + site.applicationId + '_createWorkEventEvents'; | ||
| //if you reuse this code be sure to replace _createWorkEventEvents above with the appropriate endpoint for your Model BP | ||
| console.info('getBPEvents query is ' + query); |
There was a problem hiding this comment.
ScriptStringConcatRule (ACTION, was ADVICE)
Inbound endpoint 'getBPEvents' uses string concatenation with + operator: ''getBPEvents query is ' + query'. Consider using PMD template strings with backticks and {{ }} syntax instead (e.g., Hello {{name}}!).
Why: Detects string concatenation with + operator - use PMD templates with backticks and {{ }} instead
| console.info('getBPEvents query is ' + query); | |
| console.info(`getBPEvents query is {{query}}`); |
| var query = 'SELECT businessProcessTarget, status FROM ' + site.applicationId + '_createWorkEventEvents'; | ||
| //if you reuse this code be sure to replace _createWorkEventEvents above with the appropriate endpoint for your Model BP | ||
| console.info('getBPEvents query is ' + query); | ||
| return 'data?query=' + query.pathEncode() %>", |
There was a problem hiding this comment.
ScriptStringConcatRule (ACTION, was ADVICE)
Inbound endpoint 'getBPEvents' uses string concatenation with + operator: ''data?query=' + query.pathEncode'. Consider using PMD template strings with backticks and {{ }} syntax instead (e.g., Hello {{name}}!).
Why: Detects string concatenation with + operator - use PMD templates with backticks and {{ }} instead
| return 'data?query=' + query.pathEncode() %>", | |
| return `data?query={{query.pathEncode}}`() %>", |
| @@ -0,0 +1,235 @@ | |||
| { | |||
There was a problem hiding this comment.
PMDSecurityDomainRule (ACTION)
PMD page is missing required securityDomains list. All PMD pages must define at least one security domain (excludes microConclusion and error pages).
Why: Ensures PMD pages have at least one security domain defined (excludes microConclusion and error pages unless strict mode is enabled)
| ], | ||
| "endPoints": [ | ||
| { | ||
| "name": "me", |
There was a problem hiding this comment.
EndpointFailOnStatusCodesRule (ACTION)
Inbound endpoint 'me' is missing required 'failOnStatusCodes' field.
Why: Ensures endpoints have failOnStatusCodes with minimum required codes 400 and 403
Suggested change:
"failOnStatusCodes": [{"code": 400}, {"code": 403}]
| "outboundData": { | ||
| "outboundEndPoints": [ | ||
| { | ||
| "name": "createEvent", |
There was a problem hiding this comment.
EndpointFailOnStatusCodesRule (ACTION)
Outbound endpoint 'createEvent' is missing required 'failOnStatusCodes' field.
Why: Ensures endpoints have failOnStatusCodes with minimum required codes 400 and 403
Suggested change:
"failOnStatusCodes": [{"code": 400}, {"code": 403}]
| //self.data is the payload as it exists coming into this onSend event | ||
| self.data.put('createdBy',{'id':me.id}); //add createdBy object | ||
| self.data.internalOnly = internalOnlyRadioGroup.value[0] == 'yes' ? true : false; //convert internalOnly radio group response from String to Boolean | ||
| console.info('new event payload is ' + json:asJSON(self.data)); return self.data; %>" |
There was a problem hiding this comment.
ScriptConsoleLogRule (ACTION)
File section 'outboundEndpoints[0]->name: createEvent->onSend' contains console.info statement. Remove debug statements from production code.
Why: Ensures scripts don't contain console statements (production code)
| console.info('new event payload is ' + json:asJSON(self.data)); return self.data; %>" | |
| // console.info('new event payload is ' + json:asJSON(self.data)); return self.data; %>" |
| //self.data is the payload as it exists coming into this onSend event | ||
| self.data.put('createdBy',{'id':me.id}); //add createdBy object | ||
| self.data.internalOnly = internalOnlyRadioGroup.value[0] == 'yes' ? true : false; //convert internalOnly radio group response from String to Boolean | ||
| console.info('new event payload is ' + json:asJSON(self.data)); return self.data; %>" |
There was a problem hiding this comment.
ScriptStringConcatRule (ACTION, was ADVICE)
Outbound endpoint 'createEvent' uses string concatenation with + operator: ''new event payload is ' + jsonasJSONself.data'. Consider using PMD template strings with backticks and {{ }} syntax instead (e.g., Hello {{name}}!).
Why: Detects string concatenation with + operator - use PMD templates with backticks and {{ }} instead
Suggested change:
`new event payload is {{jsonasJSONself.data}}`
| console.info('new event payload is ' + json:asJSON(self.data)); return self.data; %>" | ||
| }, | ||
| { | ||
| "name": "createWorkEventEvents", |
There was a problem hiding this comment.
EndpointFailOnStatusCodesRule (ACTION)
Outbound endpoint 'createWorkEventEvents' is missing required 'failOnStatusCodes' field.
Why: Ensures endpoints have failOnStatusCodes with minimum required codes 400 and 403
Suggested change:
"failOnStatusCodes": [{"code": 400}, {"code": 403}]
| "authType": "sso", | ||
| "onSend": "<% | ||
| //Kicks off BP. Pass in ID of the Work Event business object and when it is successfully created will trigger BP. Name element is the name of the BP in lower camel case + 'Events' from the .businessprocess file | ||
| console.info(json:asJSON(self.data)); |
There was a problem hiding this comment.
ScriptConsoleLogRule (ACTION)
File section 'outboundEndpoints[1]->name: createWorkEventEvents->onSend' contains console.info statement. Remove debug statements from production code.
Why: Ensures scripts don't contain console statements (production code)
| console.info(json:asJSON(self.data)); | |
| // console.info(json:asJSON(self.data)); |
| ] | ||
| }, | ||
| { | ||
| "name": "eventAttachments", |
There was a problem hiding this comment.
EndpointFailOnStatusCodesRule (ACTION)
Outbound endpoint 'eventAttachments' is missing required 'failOnStatusCodes' field.
Why: Ensures endpoints have failOnStatusCodes with minimum required codes 400 and 403
Suggested change:
"failOnStatusCodes": [{"code": 400}, {"code": 403}]
| @@ -0,0 +1,32 @@ | |||
| { | |||
There was a problem hiding this comment.
PMDSecurityDomainRule (ACTION)
PMD page is missing required securityDomains list. All PMD pages must define at least one security domain (excludes microConclusion and error pages).
Why: Ensures PMD pages have at least one security domain defined (excludes microConclusion and error pages unless strict mode is enabled)
| "id": "createEventWizard", | ||
| "endPoints": [ ], | ||
| "presentation": { | ||
| "body": { |
There was a problem hiding this comment.
WidgetIdRequiredRule (ACTION)
Widget of type 'editWizard' at body is missing required 'id' field.
Why: Ensures all widgets have an 'id' field set (structure validation for PMD and POD files)
| @@ -0,0 +1,119 @@ | |||
| { | |||
There was a problem hiding this comment.
PMDSecurityDomainRule (ACTION)
PMD page is missing required securityDomains list. All PMD pages must define at least one security domain (excludes microConclusion and error pages).
Why: Ensures PMD pages have at least one security domain defined (excludes microConclusion and error pages unless strict mode is enabled)
| ], | ||
| "endPoints": [ | ||
| { | ||
| "name": "getAttachments", |
There was a problem hiding this comment.
EndpointFailOnStatusCodesRule (ACTION)
Inbound endpoint 'getAttachments' is missing required 'failOnStatusCodes' field.
Why: Ensures endpoints have failOnStatusCodes with minimum required codes 400 and 403
Suggested change:
"failOnStatusCodes": [{"code": 400}, {"code": 403}]
| { | ||
| "name": "getAttachments", | ||
| "baseUrlType": "app", | ||
| "url": "<% 'attachedFiles?event=' + flowVariables.currentEvent //'instance filter' checks for files that match the given Model BO |
There was a problem hiding this comment.
ScriptStringConcatRule (ACTION, was ADVICE)
Inbound endpoint 'getAttachments' uses string concatenation with + operator: ''attachedFiles?event=' + flowVariables.currentEvent'. Consider using PMD template strings with backticks and {{ }} syntax instead (e.g., Hello {{name}}!).
Why: Detects string concatenation with + operator - use PMD templates with backticks and {{ }} instead
| "url": "<% 'attachedFiles?event=' + flowVariables.currentEvent //'instance filter' checks for files that match the given Model BO | |
| "url": "<% `attachedFiles?event={{flowVariables.currentEvent}}` //'instance filter' checks for files that match the given Model BO |
Example auditAudited 344 to fix and 0 suggestion(s). Fix before merge
Run it yourself: ACTION items fail the Audit examples check. ADVICE never blocks. Maintainers can add the 4 finding(s) are file-level and appear only in this summary. |
Added first version of Create work Event With Agent app
What this PR adds or changes
Adds an Agent on top of the Create a Work Event app catalog app.
Checklist for new or changed examples
examples/node scripts/validate-examples.mjs --checkpasses (validexample.json, README present, index table in sync)node scripts/audit-examples.mjs --changedpasses, or the findings it reports are explained below (see docs/EXAMPLE_BEST_PRACTICES.md)Anything reviewers should know?