Skip to content

ROW PTE: TCP Process Automation with Power Automate#248

Open
ChrispinP wants to merge 3 commits intomasterfrom
ChrispinP-TCP-PA-Automation
Open

ROW PTE: TCP Process Automation with Power Automate#248
ChrispinP wants to merge 3 commits intomasterfrom
ChrispinP-TCP-PA-Automation

Conversation

@ChrispinP
Copy link
Copy Markdown
Member

The purpose of this JS is to facilitate automation for the updated TCP Process which includes:

  1. The creation of multiple rounds
  2. Differentiating between intake and review phases
  3. Updating the project/round/cycle
  4. Connecting cycles to the active round
  5. Differentiating between 1st cycles and resubmittals
  6. Allowing for post approval records
  7. Transfer completed intake attachments to the 1st review cycle
  8. Notify the user of the automation's progress
  9. Auto-refresh the browser when data is ready

The JS monitors for specific form submits that will trigger a Power Automate Flow via an HTTP Post. When necessary, the JS will pass certain values/parameters to the Flow. Most actions are logged in the console so you can easily follow along as a process is running.

The JS allows us to trigger flows in a way that is more performant and less prone to breaking as each flow has a specific job. With JS we dont have to wait for Knack to index or finish updating a record, we can pass the information we need via JS and runs flows sequentially, in parallel, or pre-fire (before completion) to keep the entire process as close to real-time as possible.

image image

This work was performed in ROW PTE and is now available for testing. Task Issues: #26706 & #26328

@ChrispinP ChrispinP self-assigned this Feb 24, 2026
@ChrispinP ChrispinP added enhancement Enhancement to an existing feature or app help wanted Extra attention is needed WIP JavaScript Modified JavaScript code Knack Any Knack related PR's new feature Implementing a new feature labels Feb 24, 2026
@ChrispinP ChrispinP moved this to In Progress in DTS Apps Team Feb 24, 2026
Copy link
Copy Markdown
Contributor

@susannegov susannegov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not familiar on the TCP process to fully review it. The CONFIG variable looks okay to me. Everything else I don't have the knowledge (coding/app) to give a good review.

Styling wise I would make sure the contrast between text and background colors follows WCAG AA contrast if using a custom notification for front end users and arguably the console logs as well. I'm making this assumption based on the screenshot of the purple BG with black text font with the nice 🚗 , though the CSS on line 221 did set it to color: 'white' so maybe I am wrong.

Here's a link to a color contrast checker site if you want to play around: https://webaim.org/resources/contrastchecker/

top: '20px',
right: '20px',
padding: '20px 25px',
backgroundColor: '#9C27B0',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would change the background color for the pop-up to follow WCAG AA standards for Normal Text

Image

https://webaim.org/resources/contrastchecker/

Copy link
Copy Markdown
Contributor

@dianamartin dianamartin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chiaberry I'd love for you or someone on your team to review this PR.
@ChrispinP Do you have a short gif/mp4 of the page where the process is occuring to see what the user sees?

Copy link
Copy Markdown
Member

@frankhereford frankhereford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR. This is a lot!

I have a couple of thoughts and a request:

  • ⚠️ Can you outline the authentication mechanism in use to the web hooks and flow URLs? What system do you use for secrets if any?

  • I am concerned about the monolithic file here in terms of readability. Would you consider refactoring this down into individual files that separate out concerns? I am hopeful that will help demonstrate the larger moving parts here and how they interact.

  • I'd recommend opening this PR up to the entire dev team. While they may not all have time to offer individualized feedback, especially on this large of a PR, they will have good instincts on what will not only make this work great now, but stay working into the future. cc @chiaberry @dianamartin

Comment on lines +118 to +125
R: 'https://prod-08.usgovtexas.logic.azure.us:443/workflows/ef368a417608495783f67d5377455950/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=Z64x-_80hyVAPgfjjkXCCGJQ0BWn-D-AGwB5r-HUGFw',
rC: 'https://prod-24.usgovtexas.logic.azure.us:443/workflows/97eb3e24d26d423eb9c96258494dce04/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=zz2BK3y_tYn03Q9E4Se--fml49egWFmt9OkwO3O8v1Q',
rC1: 'https://prod-35.usgovtexas.logic.azure.us:443/workflows/a4581428a5514eca8a7062a184e567a0/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=ewKkYqb3er_TLgO7ooVT10SHTWeD6M5V869SD7vB17Y',
iC: 'https://prod-03.usgovtexas.logic.azure.us:443/workflows/9d3c05c5e3c24746a263c8aed6d46f60/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=YpFbJhyA5WHN9ugLC08kWAZfkKYePZ_y9C__JktoYNM',
iC1: 'https://prod-50.usgovtexas.logic.azure.us:443/workflows/61357f18a97644088256112a4e533c48/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=lWLNzZPLZhOzXzmkwy-BZlCsJbMy9vBf1qx8A3fsj6M',
ciC1: 'https://prod-62.usgovtexas.logic.azure.us:443/workflows/7448983fcf104882a8fa85052b99eb44/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=Mc1xkK-efDZfCC718cPtbQib0C8yO8KMjw2q7gXsdPg',
U: 'https://prod-61.usgovtexas.logic.azure.us:443/workflows/276b9618f6a144399f09563e0f764ea8/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=80QkHEIAt4SX5dMdIdRf0Y_AcSgtM4yzy8E2JuXt9UA',
P: 'https://prod-40.usgovtexas.logic.azure.us:443/workflows/0996af8f2d764b7580202f391d20b632/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=WujBv3GLBd3W-MC889WWlh5Jc8dICPLSJhrj8aZEmhg'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious what authentication system is in place here for these URLs. Is there a credential that's being sent back in a cookie? I looked at the code where you use these, and I don't see anything being explicitly added via an Authorization header.

Comment on lines +709 to +712
flowUWebhookUrl: 'https://prod-61.usgovtexas.logic.azure.us:443/workflows/276b9618f6a144399f09563e0f764ea8/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=80QkHEIAt4SX5dMdIdRf0Y_AcSgtM4yzy8E2JuXt9UA',

// PowerAutomate Flow P webhook URL (checks Knack via custom connector)
flowPWebhookUrl: 'https://prod-40.usgovtexas.logic.azure.us:443/workflows/0996af8f2d764b7580202f391d20b632/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=WujBv3GLBd3W-MC889WWlh5Jc8dICPLSJhrj8aZEmhg',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you tell me where these sig values came from? They are not an API key, right?

Comment on lines +791 to +811
.html(`
<div style="margin-bottom: 12px; font-size: 16px; color: #000000;">
Refreshing page in <span id="countdown-seconds" style="font-weight: bold;">${totalSeconds}</span> seconds...
</div>
<div id="road-container" style="position: relative; height: 40px; background-color: #555; border-radius: 4px; overflow: hidden; border: 2px solid rgba(255,255,255,0.3);">
<div style="position: absolute; width: 100%; height: 100%; background-color: #555;"></div>
<div style="position: absolute; width: 100%; top: 35%; height: 3%; background: repeating-linear-gradient(to right, #FFD700 0px, #FFD700 8px, transparent 8px, transparent 16px);"></div>
<div style="position: absolute; width: 100%; top: 62%; height: 3%; background: repeating-linear-gradient(to right, #FFD700 0px, #FFD700 8px, transparent 8px, transparent 16px);"></div>
<div id="car" style="position: absolute; top: 50%; transform: translateY(-50%) scaleX(-1); left: 0%; font-size: 24px; transition: left 0.3s linear; z-index: 10;">
🚗
</div>
<div style="position: absolute; top: 50%; transform: translateY(-50%) rotate(0deg); right: 4px; z-index: 10;">
<div style="position: relative; width: 32px; height: 32px; background: #DC143C; border: 2.5px solid white; border-radius: 3px; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 4px rgba(0,0,0,0.3);">
<span style="color: white; font-size: 9px; font-weight: bold; font-family: Arial, sans-serif; line-height: 1; text-align: center;">DONE</span>
</div>
</div>
</div>
<div id="status-message" style="margin-top: 8px; font-size: 16px; opacity: 1; text-align: center; color: #000000; font-weight: 500;">
Processing Request
</div>
`)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a lot of very specific HTML to animate a car driving on a road in CSS. Is this in lieu of a completion bar filling up? I would consider reaching for using SVG as a vector graphics format and animating that.

I am not sure that this is going to be long-term maintainable, or even really, clear enough just to grok it. I'm concerned about this application not going through the normal application development process in terms of scoping and design.

If I were asked to modify or enhance this code, the complexity and the lack of structure in the code base -- I'd be considering starting from the ground up due to the significant learning curve that I see in front of me here in this 1K diff.

Copy link
Copy Markdown
Member

@chiaberry chiaberry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I understand, this PR is adding power automate flows to the forms as well as fancy logging and animated logging.

I am not familiar at all with Power Automate, so its hard for me to give good feedback on its usage here. Where are those workflows defined?

I like the comments above the function defintions, what do you think about renaming the functions to be descriptive, like instead of triggerFlowU name it triggerFlowUpdate, same for the flowUrls. U could be update, iC1 -> intakeCycle1 etc

I am going to tag other devs in the request for review too

Comment on lines +750 to +762
if (secondsLeft >= 20) {
message = 'Processing Request';
} else if (secondsLeft >= 15) {
message = 'Connecting your Cycle';
} else if (secondsLeft >= 10) {
message = 'Petting Kittens';
} else if (secondsLeft >= 5) {
message = 'Updating your Project';
} else if (secondsLeft > 0) {
message = 'Finalizing Data';
} else {
message = 'Complete!';
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What defines these breakpoints? Is everything assured to finish in this time frame? What is "Petting Kittens?"

Comment on lines +716 to +718
pollIntervalMs: 1000, // Check every 1 second initially
fastPollStartMs: 12000, // Start polling every 1s after 12 seconds
fastPollIntervalMs: 1000, // Check every 1 second after 12s
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this reads that it starts at a one second interval and then after 12 seconds, switches to a 1 second interval. Can you explain the two tiered approach? I'm curious why this extra complexity is required.

@TracyLinder TracyLinder removed their request for review February 27, 2026 19:19
@mddilley mddilley removed their request for review April 6, 2026 16:01
@mateoclarke mateoclarke removed their request for review April 15, 2026 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Enhancement to an existing feature or app help wanted Extra attention is needed JavaScript Modified JavaScript code Knack Any Knack related PR's new feature Implementing a new feature WIP

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

5 participants