Code block

A monospaced block for displaying code, JSON payloads, or fixed-width content.

A monospaced block for displaying code, JSON, or any fixed-width content. Typically used in internal/admin forms where the form itself shows configuration data.

It is a static display block, it carries no value and writes nothing to SharePoint.

Properties

PropertyDescription
text
string
default: console.log("hello world");
The code / fixed-width content shown in the block.
language
string
default: javascript
Programming language label for the block, e.g. json, typescript, powershell.

JavaScript recipes

Show the form context for support

// Useful in internal/admin forms: render the live form context.
f365.events.onLoad(() => {
  const ctx = f365.context;
  console.log({ formId: ctx.formId, listId: ctx.listId, itemId: ctx.itemId, mode: ctx.displayMode });
});

Hide the block outside edit mode

// Code blocks often only make sense while authoring; hide on DispForm.
f365.events.onLoad(() => {
  const el = f365.field('Notes').el(); // anchor off a nearby addressable field
  if (f365.context.displayMode === 'display' && el) el.closest('.f365-cell')?.remove();
});

Dump current form data as JSON

// Snapshot every field value keyed by SP internal name when "Config" changes.
f365.events.onChange((e) => {
  if (e.fieldKey !== 'Config') return;
  const snapshot = f365.data();
  console.log(JSON.stringify(snapshot, null, 2));
});

Related articles

  • Custom HTML

    Drop arbitrary HTML into the form, escape hatch for embeds, third-party widgets, and content the standard components don't cover.

  • Text block

    A static text container with richer formatting options than Paragraph, used for headed callouts and styled copy.