Lädt...


🔧 PACX ⁓ Init custom tables main form


Nachrichtenbereich: 🔧 Programmierung
🔗 Quelle: dev.to

When I'm working on Model Driven Apps or Dynamics 365 Customer Engagement, one of the most annoying things I have to do every time I create a new custom table is to fix the table main form 😒.

"Fix"? What do you mean?

The out of the box form comes out like this:

Out of the box form

As you can see, there is one single tab, with one single headless section, containing the primary field and the owner field. The tab has no name. If you select just the section, you'll see that also the section has no name.

Out of the box form with selected section

Moreover, important fields such as Created By, Created On, Modified By and Modified On, that are really useful to get a visible feedback on the record history, aren't placed within the form.

What I always have to do is:

  • Set a name on the first tab (tipically, tab_general, following the pattern tab_ + tab title all lowercase without spaces)
  • Set a name on the included section (tipically, tab_general_sec_general, following the pattern parent tab name + _sec_ + section title all lowercase without spaces)
  • Remove the Owner field from the section
  • Add a second tab called "Administration" (tab_admin) with a single headless 2-column section (tab_admin_sec_admin), containing Created By, Created On, Modified By, Modified On and Owner fields, with a nicely aligned layout.

This, for all the custom tables I create 😤.

PACX to the rescue! 🚨

Just a couple of days ago I had to do it for 10 tables in a row for a solution I'm setting up... too much manual work for a lazy guy like me.

Then I thought: "What if the same time spent on doing that manually, I'm gonna spend it writing a PACX command that does the same stuff automatically?"

After a couple of try-and-error (really helpful lessons learned) the new command is born: pacx forms clean.

pacx forms clean

The command does exactly what described before:

  • It sets the name attribute on each unnamed tab, starting from the tab label
  • It sets the name attribute on each unnamed section, starting from the parent tab name and the section label
  • Removes the "Owner" field from the first tab, if present.
  • Creates a new tab called "Administration", with a single untitled 2-columns section, containing "Created On", "Created By", "Modified On", "Modified By" and "Owner" fields.

And the result is:

Output 1

Output 2

Output 3

But... how does it works? 🤔

I've tested 2 different strategies to update the main form.

The first one was to:

  • read the formxml directly from the Dataverse systemform table
  • update the XML in memory
  • update the systemform record with the updated XML

But I've realized that on the systemform table there are 2 fields representing the form structure, formxml and formjson, and I've seen that a direct update of the formxml field didn't get reflected on the corrisponding formjson, neither after a publish... so I had to try a different path.

For the second try I took inspiration from the Ribbon Workbench approach (thanks JVE for the hint, and Scott Durow for the awesome tool). The solution was to:

  • Create a temporary solution
  • Add the form to the temporary solution
  • Download the temporary solution
  • In memory
    • Unzip the solution
    • Extract the customizations.xml file
    • Manipulate the formxml within the customizations.xml file
    • Repack the zipped file
  • Then re-upload the solution and publish
  • After all, delete the temporary solution

Et voilà, les jeux sont faits.

🔍 If you're interested on internals you can take a look at the source code.

📦 The command is available on PACX version 1.2024.10.153 or above.

...

🔧 PACX ⁓ Init custom tables main form


📈 80.69 Punkte
🔧 Programmierung

🔧 PACX ⁓ WebResource Management Commands - Init


📈 39.98 Punkte
🔧 Programmierung

🔧 Using Mapping Tables to Merge Data with Auto-Number Keys Referenced by Other Tables


📈 27.57 Punkte
🔧 Programmierung

🔧 How to Apply Sorting on Tables in HTML Using JavaScript: Sortable Paginated Tables


📈 27.57 Punkte
🔧 Programmierung

🔧 HTML Tables: how to create and style tables with HTML


📈 27.57 Punkte
🔧 Programmierung

📰 Storytelling with Tables Part 1: Tables with Plotly


📈 27.57 Punkte
🔧 AI Nachrichten

🕵️ Low CVE-2015-9401: Websimon-tables project Websimon-tables


📈 27.57 Punkte
🕵️ Sicherheitslücken

🕵️ Medium CVE-2017-18597: Jtrt responsive tables project Jtrt responsive tables


📈 27.57 Punkte
🕵️ Sicherheitslücken

📰 Microsoft Excel Can Now Turn Pictures of Tables Into Actual, Editable Tables


📈 27.57 Punkte
📰 IT Security Nachrichten

🔧 PACX ⁓ Create a table


📈 25.78 Punkte
🔧 Programmierung

🔧 PACX ⁓ Working with solutions


📈 25.78 Punkte
🔧 Programmierung

🔧 PACX ⁓ Data model manipulation


📈 25.78 Punkte
🔧 Programmierung

🔧 PACX ⁓ Connect to Dataverse environment


📈 25.78 Punkte
🔧 Programmierung

🔧 PACX ⁓ Command Line Utility Belt for Power Platform / Dataverse


📈 25.78 Punkte
🔧 Programmierung

🔧 PACX ⁓ WebResource Management Commands - Push


📈 25.78 Punkte
🔧 Programmierung

🔧 PACX ⁓ WebResource Management Commands - Create JS


📈 25.78 Punkte
🔧 Programmierung

🔧 PACX ⁓ Create columns: Choice (Picklist)


📈 25.78 Punkte
🔧 Programmierung

🔧 PACX ⁓ Create columns: Boolean


📈 25.78 Punkte
🔧 Programmierung

🔧 PACX ⁓ Create columns: Numeric


📈 25.78 Punkte
🔧 Programmierung

🔧 PACX ⁓ Create columns: Text


📈 25.78 Punkte
🔧 Programmierung

🕵️ Cgiscript.net csMailto csMailto.cgi form-to/form-from/form-results privilege escalation


📈 25.07 Punkte
🕵️ Sicherheitslücken

🔧 The main methods of joining tables in PostgreSQL.


📈 24.85 Punkte
🔧 Programmierung

🔧 How to make a custom form item in React Hook Form


📈 24.22 Punkte
🔧 Programmierung

🕵️ CVE-2024-32892 | Google Android goodix/main/main.c handle_init type confusion


📈 22.13 Punkte
🕵️ Sicherheitslücken

🔧 Swift Best Practices: The Crucial Importance of Executing Code on the Main Thread or Main Actor


📈 22.13 Punkte
🔧 Programmierung

🔧 Composable Form with react-hook-form


📈 16.72 Punkte
🔧 Programmierung

🕵️ Medium CVE-2021-24144: Contact form 7 database addon Contact form 7 database addon


📈 16.72 Punkte
🕵️ Sicherheitslücken

matomo