Custom JavaScript in 10 minutes
The f365 runtime API at a glance. Read field values, hook events, call SharePoint, show dialogs, all from one drawer.
Every form has a built-in code drawer (toolbar → </> icon). The JavaScript you
write there runs at form load and receives the f365 object. Ten
minutes of reading the right docs unlocks most of what you'd ever want to build.
The shape
(f365) => {
// Your code here. Runs once at form load.
// Hook events, prefill values, set up cascades.
};
The function is wrapped in new Function('f365', body) at runtime, so this is undefined, top-level await isn't available
(use async functions inside event handlers), and global timer
functions are shadowed by their f365-tracked variants.
The first ten minutes
Read and write a field value
const title = f365.field('Title').value;
f365.field('Title').value = 'Renamed';
Hook a change event
f365.events.onChange('Status', (next, prev) => {
console.log(`Status changed: ${prev} → ${next}`);
});
Show, hide, enable a field
f365.field('Notes').visible = false;
f365.field('Approve').enabled = f365.user.isInGroup('Approvers');
Block submit conditionally
f365.events.onBeforeSave(() => {
if (!f365.field('AgreedToTerms').value) {
f365.ui.showAlert('You must accept the terms.');
return { cancel: true };
}
});
Read related SharePoint data
f365.events.onChange('CustomerId', async (id) => {
if (!id) return;
const customer = await f365.sp.web.lists
.getByTitle('Customers')
.items.getById(id)
.select('Tier', 'AccountManager')
.get();
f365.field('Tier').value = customer.Tier;
f365.field('AccountManager').value = customer.AccountManager;
});
Redirect after save
f365.events.onSave(({ itemId }) => {
f365.nav.redirectAfterSave(`/SitePages/thank-you.aspx?id=${itemId}`);
});
Where to go from here
- f365 API overview, the full surface
- f365.field, every property and method
- f365.events, form lifecycle hooks
- f365.sp, the PnPjs SP client
Per-field handlers
For event handlers that belong to one field rather than the whole form, use the
per-field event slot in the field's properties panel, same f365
parameter, scoped to one field.
Tooling
Drop docs/forms365-internal.d.ts (ships with the product) into your
project's typings/ folder for IntelliSense if you author externally
in VS Code.