# How to Add a Personalization Script to an M3 H5 Panel

> Source: https://netray.co/erp-help/m3-h5-personalization-script-mforms-how-to
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: ERP Help

## Short answer

M3 H5 lets an administrator attach a JavaScript personalization script to a specific panel of a specific program, using the MForms client API to read fields, react to panel and field events, and adjust the UI (hide fields, set defaults, validate input) without modifying the underlying M3 program. Scripts are written and attached through Personalization mode in H5, saved against the panel/program combination, and deployed to the users or roles who should see the behavior.

## Kind

how-to

## System

infor-m3

## Erp

Infor M3 (M3 Business Engine)

## Module

M3 H5 Client / UI Scripting

## Query

How to add a personalization script in M3 H5 client

## Alternate Queries

- M3 H5 MForms scripting guide
- how to run custom JavaScript on an M3 H5 panel
- M3 H5 personalization script not triggering
- M3 H5 client scripting API basics

## Applies To

Infor M3 H5 Client (all supported CloudSuite/M3 Business Engine versions shipping the H5 UI)

## Steps

### Add a personalization script to an H5 panel

**Items:**

- Confirm you have Application Administrator (or equivalent personalization) rights in H5 - regular end users can personalize layout but not attach scripts.
- Open the target program and navigate to the exact panel where the behavior should apply; scripts attach at the panel level, not the whole program.
- Enter Personalization mode from the H5 toolbar/gear icon and open the scripting option for that panel.
- Write the script against the MForms client API, using panel-load and field-change event hooks rather than polling the DOM directly.
- Reference fields by their panel field name (visible in the panel's field properties, not the on-screen label) so the script keeps working if the label is later translated or renamed.
- Test the script in a non-production environment first, exercising both the normal path and edge cases (empty field, invalid value) before saving.
- Save the script against the panel and decide the deployment scope - all users, a specific role, or a specific user - matching how narrowly the behavior should apply.
- Document what the script does and why in a change log outside H5 itself, since personalization scripts do not show up in standard M3 program documentation or upgrade impact reports.

## Sections

### What personalization scripts are for

**Body:**

H5 personalization scripts exist for the class of UI change that is too specific to justify a real program modification: defaulting a field based on another field's value, hiding a field that is irrelevant for one company or division, adding client-side validation before a user submits, or auto-formatting an input. They run entirely in the browser session and do not change the underlying M3 program, API behavior, or data model - which is exactly why they are the right tool for cosmetic and convenience logic, and the wrong tool for anything that needs to be enforced consistently regardless of which client calls M3 (a batch job or API integration will never see this UI logic).

Because scripts are attached per panel and are invisible to anyone not looking specifically in Personalization mode, they are easy to forget about. A field that mysteriously defaults or a validation message nobody can find in the program's setup is a strong sign a personalization script is involved somewhere.

### Working with the MForms API

**Body:**

The MForms object is the client-side API H5 scripts use to interact with the panel: reading and setting field values, listening for field-change and panel-load events, and controlling visibility or enabled state of fields on the current panel. Scripts should hook the specific events they need (a field's change event, the panel's load event) rather than running continuous checks, both for performance and because H5's panel lifecycle does not guarantee a stable DOM to poll against between events.

Keep scripts defensive: check that a field exists and has a value before acting on it, since the same panel can appear in slightly different states (add mode versus change mode, different field visibility by role) and a script written against one state can throw errors in another.

**Code:**

// Simplified pattern - actual MForms API calls vary by H5 version
MForms.onFieldChange("WHLO", function(value) {
  if (value === "CENTRAL") {
    MForms.setFieldValue("TEDL", "DEFAULT-ROUTE");
  }
});

### Deployment scope and upgrade risk

**Body:**

Deploying a script broadly (all users of a panel) versus narrowly (one role or one user) is a real tradeoff: broad deployment means the behavior is consistent but any bug affects everyone immediately, while narrow deployment limits blast radius but creates inconsistent behavior across the user base that is easy to lose track of. Keep an inventory of which panels have active personalization scripts and who they are scoped to, since H5 does not surface this centrally and it is easy to accumulate scripts that nobody remembers writing.

Personalization scripts generally survive M3 platform updates since they sit outside the core program, but a field rename, a panel redesign, or a CloudSuite update that changes panel structure can silently break a script that referenced the old field name or layout. Re-test personalization scripts as part of your update/upgrade regression pass, not just the core program functionality.

## Pitfalls

- Using a personalization script to enforce a business rule that really needs to apply everywhere, including batch jobs and API calls, which the script will never see.
- Referencing a field by its on-screen label instead of its panel field name, breaking the script when the label is translated or edited.
- Polling the DOM continuously instead of hooking MForms field-change and panel-load events, which hurts performance and behaves inconsistently across panel states.
- Not testing add mode, change mode, and different role-based field visibility before deploying a script broadly.
- Losing track of which panels have scripts attached, since H5 has no single central inventory view most administrators check regularly.
- Skipping personalization scripts during upgrade or update testing because they are not part of the core program.

## Ai Angle

ERPray can inventory which H5 panels across your M3 environment have personalization scripts attached and summarize what each one does in plain language by reading the script logic, which is useful before an update or a handover, when nobody currently remembers every piece of client-side customization that has accumulated over time.

## Faq

### Do personalization scripts require a developer license or SDK?

**Answer:** No separate license is typically required beyond Application Administrator rights and H5 access; scripts are written and attached directly in the H5 UI's Personalization mode using standard JavaScript against the MForms API.

### Can a personalization script call an M3 API transaction directly?

**Answer:** Scripts are scoped to client-side panel interaction, not arbitrary backend calls. Logic that needs to read or write other M3 data beyond the current panel is better handled through a proper extension or integration, not a personalization script.

### Why did my script stop working after a CloudSuite update?

**Answer:** A panel layout change, field rename, or MForms API adjustment in the update can break a script that assumed the previous structure. Compare the script's field references against the current panel's field names first.

### Can I copy a personalization script from one panel to another similar panel?

**Answer:** You can reuse the logic, but field names and available events can differ even between visually similar panels on different programs, so treat it as a starting point to adapt and retest rather than a direct copy that will work unchanged.

## Search terms

M3 H5 personalization script, M3 H5 MForms API, M3 H5 client scripting, M3 H5 custom JavaScript panel, M3 H5 field default script, H5 panel personalization mode, M3 H5 script deployment, Infor M3 H5 UI customization, M3 H5 field change event, M3 H5 script upgrade break

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
