Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 500 Error When Applying Templates to Unsaved Screen Pages #7501

Merged
merged 2 commits into from
Oct 15, 2024

Conversation

sanjacornelius
Copy link
Contributor

@sanjacornelius sanjacornelius commented Oct 8, 2024

Issue & Reproduction Steps

This PR addresses the 500 error encountered when attempting to apply a template to a screen page that has not been stored in the database. The root cause was the absence of the newly created screen page in the screens table during the query for the screen configuration.

Solution

  • Implemented a query using the screens_versions table, which retains the 'draft' version of the screen.
  • Added a fallback mechanism to handle cases where the screens_versions table is unavailable. When this occurs, an error message prompts the user to save the screen.

How to Test

Without Versions Package

  1. Ensure screen templates are created and available.
  2. Open or create a new screen in Screen Builder.
  3. Add a new page within the screen.
  4. Go to the newly created page.
  5. Select 'Templates' in the navigation bar.
  6. Choose a template and apply all settings.
  7. Ensure an error message prompts you to save the screen.
  8. Save the screen as instructed by the error message.
  9. Try to apply the template again.
  10. Ensure the template is successfully applied to the selected page.

With Versions Package

  1. Ensure the versions package is installed using branch observation/FOUR-19320
  2. Ensure screen templates are created and available.
  3. Open or create a new screen in Screen Builder.
  4. Add a new page within the screen.
  5. Go to the newly created page.
  6. Select 'Templates' in the navigation bar.
  7. Choose a template and apply all settings.
  8. Ensure the template is successfully applied to the selected page.

Related Tickets & Packages

ci:screen-builder:observation/FOUR-19320
ci:package-versions:observation/FOUR-19320

Code Review Checklist

  • I have pulled this code locally and tested it on my instance, along with any associated packages.
  • This code adheres to ProcessMaker Coding Guidelines.
  • This code includes a unit test or an E2E test that tests its functionality, or is covered by an existing test.
  • This solution fixes the bug reported in the original ticket.
  • This solution does not alter the expected output of a component in a way that would break existing Processes.
  • This solution does not implement any breaking changes that would invalidate documentation or cause existing Processes to fail.
  • This solution has been tested with enterprise packages that rely on its functionality and does not introduce bugs in those packages.
  • This code does not duplicate functionality that already exists in the framework or in ProcessMaker.
  • This ticket conforms to the PRD associated with this part of ProcessMaker.

Copy link
Contributor

@mcraeteisha mcraeteisha left a comment

Choose a reason for hiding this comment

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

Approved!

@sanjacornelius sanjacornelius changed the base branch from epic/FOUR-18012 to release-2024-fall October 9, 2024 17:01
@ryancooley ryancooley merged commit 025a3eb into release-2024-fall Oct 15, 2024
17 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants