Form and list options
Buttons, list colours, connections, calendar and Gantt views, indexes and search, all from YAML.
These keys change how the desk shows a RecType. None needs frontend code.
Form buttons
actions adds buttons to the form. A Server Action calls an RPC. A Route opens a desk path, whose {fieldname} parts the desk fills from the record.
actions:
- {label: Scrap Asset, action_type: Server Action, action: erp.asset.scrap,
depends_on: "doc.docstatus == 1 && doc.status != 'Scrapped'"}
- {label: Restore Asset, action_type: Server Action, action: erp.asset.restore,
depends_on: "doc.docstatus == 1 && doc.status == 'Scrapped'"}| Key | Meaning |
|---|---|
label | The button text |
action_type | Server Action or Route |
action | The RPC path, or the desk path |
group | A toolbar dropdown that holds it, such as Create. Without it the button stands alone |
depends_on | An expression over doc. Without it the button shows on saved records only |
hidden | Hides it |
The RPC receives rectype and doc:
@rpc requires: {:cancel, "Budget"}, args: [rectype: :string, doc: :map]
def revise(ctx, %{doc: %{"name" => name}}) do
with {:ok, new, fx} <- Budget.revise(ctx, name), do: {:ok, %{"name" => new}, fx}
endList colours
states maps a status to an indicator colour in the list.
states:
- {title: Draft, color: danger}
- {title: Submitted, color: info}
- {title: Fully Depreciated, color: success}For logic beyond a status match, use a list plugin's indicator. See Desk plugins.
Connections
links lists records of other RecTypes that point at this one. The form shows them in its Connections panel.
links:
- {link_rectype: Failed Lead Sync Log, link_fieldname: source}Each entry takes link_rectype, link_fieldname, an optional group and hidden. To add groups to another app's RecType, use the manifest's connections:
connections: [
{"CRM Organization", [%{label: "Deals", items: [{"CRM Deal", "organization"}]}]}
]An item is {rectype, field}, or {rectype, "<table>.<field>"} for a child row. Apps that list the same RecType add up.
Calendar and Gantt
calendar: {start: exp_start_date, end: exp_end_date, title: subject}
gantt: {start: exp_start_date, end: exp_end_date, title: subject, progress: progress, dependencies: depends_on}calendar takes start and optional end, title and all_day. gantt takes start, end and optional title, progress and dependencies, a Table whose rows name the records this one depends on.
Indexes
indexes:
- {fields: [src_rectype, src_name]}
- {fields: [dst_rectype, dst_name]}Add unique: true for a unique index.
Global search
Mark fields with in_global_search: true. Then list the RecType in the manifest, in the order Ctrl+G shows the groups:
global_search: ["CRM Lead", "CRM Deal", "Contact", "CRM Organization", "FCRM Note"]The installer adds the list to Global Search Settings. Hits are only records the user may read.
Create menu
The manifest's create puts entries in a saved record's Create menu. Each is %{from, to, rpc} with an optional depends_on. The RPC answers an unsaved to record for source_name, usually through Cardinal.Mapper. See Platform modules.